<div dir="ltr">Looks like a good start! Thanks.<div><br></div><div>I&#39;m not sure whether <span style="font-size:13px;font-family:arial,sans-serif">&lt;gromacs xmlns:gmx=&quot;</span><a href="http://www.gromacs.org/schemas" target="_blank" style="font-size:13px;font-family:arial,sans-serif">http://www.gromacs.<u></u>org/schemas</a><span style="font-size:13px;font-family:arial,sans-serif">&quot;&gt; should name a schema file, or a place to look up a schema file. Does anyone know? In the past I have seem XML files with namespace-specific content like</span></div>
<div><span style="font-size:13px;font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">  &lt;gmx:sfactors type=&quot;Fourier&quot; force_field=&quot;any&quot; displaced_solvent=&quot;true&quot; reference=&quot;&quot;&gt;</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">    &lt;gmx:sfactor residue=&quot;ALA&quot; atom=&quot;MW&quot; type=&quot;1&quot;&gt;</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-size:13px;font-family:arial,sans-serif"><br>
</span></div><div><span style="font-size:13px;font-family:arial,sans-serif">which I&#39;m sure we&#39;d like to avoid. Does David&#39;s suggestion achieve that? Presumably we&#39;d want something like xmllint to be able to validate against the schema named in the XML file. Are we able to organize such a schema for sfactor? I&#39;ve never written one.</span></div>
<div><span style="font-size:13px;font-family:arial,sans-serif"><br></span></div><div><span style="font-size:13px;font-family:arial,sans-serif">Mark</span></div><div><span style="font-size:13px;font-family:arial,sans-serif"><br>
</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Nov 16, 2013 at 1:43 PM, David van der Spoel <span dir="ltr">&lt;<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2013-11-14 06:18, Teemu Murtola wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Hi all,<br>
<br>
just a few quick comments on some technical details.<br>
<br>
          &gt; On 2013-11-11 02:43, Erik Lindahl wrote:<br>
          &gt;&gt; I’m fine with having it as a hard dependency, provided<br>
        we’ve had it<br>
          &gt;&gt; compile automatically during installs for a while without<br>
        complaints (it<br>
          &gt;&gt; has been on by default for 4.6, right?).<br>
<br>
<br>
We&#39;ve had it on by default if it is found for ages, but the build system<br>
has semi-silently dropped it from the build if it is not found, with no<br>
user-visible consequences, so I&#39;m not sure whether that qualifies as the<br>
required testing.<br>
<br>
        On Nov 11, 2013 8:33 AM, &quot;David van der Spoel&quot;<br>
        &lt;<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a> &lt;mailto:<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>&gt;<br></div><div class="im">
        &lt;mailto:<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a> &lt;mailto:<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>&gt;&gt;<u></u>&gt; wrote:<br>
<br>
         &gt; In addition, for many small files<br>
        you don&#39;t need a dtd or schema (and in fact there isn&#39;t one for<br>
        these<br>
        xml files), it&#39;s just that the libxml2 library demands you put<br>
        it into<br>
        the file. If we&#39;re talking rtp files then that&#39;s another matter<br>
        where<br>
        more structure is needed.<br>
<br>
<br>
Where does this &quot;demand from libxml2&quot; come from? The unit testing stuff<br>
in master has been writing and reading XML files without DTDs or schemas<br>
for years now using libxml2, and no one has reported any issues. So I<br>
don&#39;t think there is any hard demand for a DTD in the XML file that it<br>
parses. Additionally, I think that referencing a non-existent DTD file<br>
serves no purpose whatsoever. I think that either you need to actually<br>
write that DTD, or remove the reference.<br>
<br>
On Wed, Nov 13, 2013 at 8:57 PM, David van der Spoel<br></div><div><div class="h5">
&lt;<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a> &lt;mailto:<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>&gt;&gt; wrote:<br>
<br>
        The thing is that for small files it doesn&#39;t matter, neither DTD<br>
        nor Schema is used if you don&#39;t need it. I still have a hard<br>
        time comprehending why we would like to mix e.g. simulation data<br>
        with all possible other stuff.<br>
<br>
<br>
I think others&#39; point is that without DTD or Schema validation, you need<br>
to write a lot of validation stuff yourself, which is a lot of code, or<br>
just live with the fact that all kinds of malformed input can get<br>
accepted, which isn&#39;t much better than text files.<br>
<br>
        Just check libxml++ but that introduces another dependency so<br>
        that&#39;s out. I will draft a gromacs frontend in C++ for libxml2<br>
        with just subset of the functionality. There is however one<br>
        issue: XML can be read in two fashions, using the DOM (Document<br>
        Object Model) and using SAX (Simple API for XML). Until now I<br>
        have used the DOM, which reads a whole document into memory, but<br>
        the memory usage can be prohibitive. SAX should therefore be the<br>
        preferred route. Any comments on that?<br>
<br>
<br>
I think that unless we need to read very big XML files, DOM is a lot<br>
more flexible. Parsing more complex data structures in SAX requires the<br>
parser that receives all the SAX callbacks be a relatively complex state<br>
machine, as it needs to incrementally construct all the data structures.<br>
Code with the same level of functionality and modularity is probably a<br>
lot easier to write and understand if written using DOM. If you want to<br>
keep the ability to not load the whole document, using the third option<br>
in libxml2, the reader API, is probably a better idea.<br>
<br>
It would be nice if the frontend would also be able to abstract away the<br>
current usage of libxml2 in src/testutils/refdata.cpp. However, that is<br>
perhaps quite different from what most other Gromacs code will use it,<br>
so it may not be the highest priority. It is already quite well<br>
encapsulated in this single file. But this is something to think about<br>
in the design.<br>
<br>
Teemu<br>
<br>
<br>
</div></div></blockquote>
Some progress. How&#39;s this:<br>
<br>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&lt;gromacs xmlns:gmx=&quot;<a href="http://www.gromacs.org/schemas" target="_blank">http://www.gromacs.<u></u>org/schemas</a>&quot;&gt;<br>
  &lt;sfactors type=&quot;Fourier&quot; force_field=&quot;any&quot; displaced_solvent=&quot;true&quot; reference=&quot;&quot;&gt;<br>
    &lt;sfactor residue=&quot;ALA&quot; atom=&quot;MW&quot; type=&quot;1&quot;&gt;<br>
      &lt;a0 unit=&quot;e&quot;&gt;<br>
     10.0369<br>
      &lt;/a0&gt;<br>
      &lt;q0 unit=&quot;1/A&quot;&gt;<br>
           0<br>
      &lt;/q0&gt;<br>
....<br>
  &lt;/sfactors&gt;<br>
&lt;/gromacs&gt;<div class="im"><br>
<br>
<br>
-- <br>
David van der Spoel, Ph.D., Professor of Biology<br>
Dept. of Cell &amp; Molec. Biol., Uppsala University.<br>
Box 596, 75124 Uppsala, Sweden. Phone:  <a href="tel:%2B46184714205" value="+46184714205" target="_blank">+46184714205</a>.<br>
<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>    <a href="http://folding.bmc.uu.se" target="_blank">http://folding.bmc.uu.se</a><br>
-- <br></div>
gromacs.org_gmx-developers mailing list<br>
<a href="mailto:gromacs.org_gmx-developers@maillist.sys.kth.se" target="_blank">gromacs.org_gmx-developers@<u></u>maillist.sys.kth.se</a><br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" target="_blank">https://maillist.sys.kth.se/<u></u>mailman/listinfo/gromacs.org_<u></u>gmx-developers</a><div class="HOEnZb"><div class="h5">
<br>
Please don&#39;t post (un)subscribe requests to the list. Use the<br>
www interface or send it to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@<u></u>gromacs.org</a>.<br>
</div></div></blockquote></div><br></div>