<div dir="ltr">Hi all,<div><br></div><div>just a few quick comments on some technical details.<br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="h5"> &gt; On 2013-11-11 02:43, Erik Lindahl wrote:<br>
 &gt;&gt; I’m fine with having it as a hard dependency, provided we’ve had it<br>
 &gt;&gt; compile automatically during installs for a while without complaints (it<br>
 &gt;&gt; has been on by default for 4.6, right?).<br></div></blockquote></blockquote><div><br></div><div>We&#39;ve had it on by default if it is found for ages, but the build system has semi-silently dropped it from the build if it is not found, with no user-visible consequences, so I&#39;m not sure whether that qualifies as the required testing.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5">On Nov 11, 2013 8:33 AM, &quot;David van der Spoel&quot; &lt;<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a></div><div class="h5">&lt;mailto:<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>&gt;&gt; wrote:<span style="color:rgb(34,34,34)"> </span></div>
</div></blockquote></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5">&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 these<br>
xml files), it&#39;s just that the libxml2 library demands you put it into<br>
the file. If we&#39;re talking rtp files then that&#39;s another matter where<br>
more structure is needed.<br></div></div></blockquote></blockquote><div><br></div><div>Where does this &quot;demand from libxml2&quot; come from? The unit testing stuff in master has been writing and reading XML files without DTDs or schemas for years now using libxml2, and no one has reported any issues. So I don&#39;t think there is any hard demand for a DTD in the XML file that it parses. Additionally, I think that referencing a non-existent DTD file serves no purpose whatsoever. I think that either you need to actually write that DTD, or remove the reference.</div>
<div><br></div><div>On Wed, Nov 13, 2013 at 8:57 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
</blockquote></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><div class="h5"><span style="color:rgb(34,34,34)">The thing is that for small files it doesn&#39;t matter, neither DTD nor Schema is used if you don&#39;t need it. I still have a hard time comprehending why we would like to mix e.g. simulation data with all possible other stuff.</span><br>
</div></div></blockquote></blockquote><div><br></div><div>I think others&#39; point is that without DTD or Schema validation, you need to write a lot of validation stuff yourself, which is a lot of code, or just live with the fact that all kinds of malformed input can get accepted, which isn&#39;t much better than text files.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span style="color:rgb(34,34,34)">Just check libxml++ but that introduces another dependency so that&#39;s out. I will draft a gromacs frontend in C++ for libxml2 with just subset of the functionality. There is however one issue: XML can be read in two fashions, using the DOM (Document Object Model) and using SAX (Simple API for XML). Until now I have used the DOM, which reads a whole document into memory, but the memory usage can be prohibitive. SAX should therefore be the preferred route. Any comments on that?</span></blockquote>
</div></blockquote><div><br></div><div>I think that unless we need to read very big XML files, DOM is a lot more flexible. Parsing more complex data structures in SAX requires the parser that receives all the SAX callbacks be a relatively complex state machine, as it needs to incrementally construct all the data structures. Code with the same level of functionality and modularity is probably a lot easier to write and understand if written using DOM. If you want to keep the ability to not load the whole document, using the third option in libxml2, the reader API, is probably a better idea.</div>
<div><br></div><div>It would be nice if the frontend would also be able to abstract away the current usage of libxml2 in src/testutils/refdata.cpp. However, that is perhaps quite different from what most other Gromacs code will use it, so it may not be the highest priority. It is already quite well encapsulated in this single file. But this is something to think about in the design.</div>
<div><br></div><div>Teemu</div></div></div></div></div>