[gmx-developers] libxml2

Teemu Murtola teemu.murtola at gmail.com
Fri Nov 22 06:04:52 CET 2013


One additional comment that I forgot yesterday:


On Thu, Nov 21, 2013 at 10:08 PM, Teemu Murtola <teemu.murtola at gmail.com>wrote:

> On Mon, Nov 18, 2013 at 5:23 PM, Mark Abraham <mark.j.abraham at gmail.com>wrote:
>
>> Looks like a good start! Thanks.
>>
>> I'm not sure whether <gromacs xmlns:gmx="http://www.gromacs.org/schemas">
>> should name a schema file, or a place to look up a schema file. Does anyone
>> know?
>>
>
> As Erik said, it's just a string with no direct semantics. And there is no
> strict correspondence between schemas and namespaces, either. I'm not an
> expert on this, but at least it is possible to have multiple schemas that
> all declare parts of the same namespace, and composite schemas created from
> these. A single schema can also reference multiple namespaces (but must in
> such a case import schemas for the other namespaces). And the location of
> the schema is often declared using a separate attribute
> (xsi:schemaLocation, with suitably defined xsi:), separately from the
> namespace. Don't know exactly what kind of look-up rules different parsers
> use for the schema locations.
>
> If we want to publish the schemas on the web page, we also need to
> consider versioning. What is going to happen if, say, Gromacs 6.0 needs to
> change these schemas somehow? If we just replace them on the web page,
> earlier files are going to break. It's unrealistic to assume that we can
> design something that is going to remain static forever, in particular if
> we start from a corner like this instead from a central concept like the
> topology representation.
>
> For the units, I don't have a strong opinion, but do we really want to
> implement a mini-language that we then must parse and validate to be able
> to specify arbitrary units and arbitrary unit conversions, and force the
> users to type them everywhere? One simple alternative would be to just
> encode the expected unit in the name of the element.
>

Is it a good idea to have a root-level <gromacs> element instead of
starting directly with <sfactors>? The root element being in a
Gromacs-specific namespace should be enough indication that this is a
Gromacs file, and that <gromacs> element makes it difficult to use this
file as part of a larger entity through inclusion, which at least Erik was
suggesting. Also, if all files would have the same root element, it is
somewhat difficult (but probably not impossible) to compose a schema for
that element from parts that could be used independently. Similarly, extra
code is needed to check that the file actually contains the expected
subelement and/or extract the relevant element; we may need that code in
the future anyways, though, if we want to allow composite XML files.


> In the past I have seem XML files with namespace-specific content like
>>
>>   <gmx:sfactors type="Fourier" force_field="any" displaced_solvent="true"
>> reference="">
>>     <gmx:sfactor residue="ALA" atom="MW" type="1">
>>
>> which I'm sure we'd like to avoid. Does David's suggestion achieve that?
>>
>
> It doesn't. It declares that anything prefixed with gmx: is in the given
> namespace, but doesn't actually use that prefix for anything. If you want
> to declare that unqualified elements go into a specific namespace, you need
> to use xmlns="…".
>

Regards,
Teemu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20131122/0bab00b2/attachment.html>


More information about the gromacs.org_gmx-developers mailing list