
Hi Freek/All; On 8/16/11 7:36 AM, thus spake Roman Ćapacz:
W dniu 2011-08-16 12:09, Freek Dijkstra pisze:
Hi,
Hi Freek,
I've been thinking about the relation syntax.
So far, we have seen these two proposals:
<nml:link id="urn:ogf:network:example.net:link_A-to-C"> <nml:relation type="serialcompound"> ... </nmlserialcompound:relation> </nml:link>
I think you mean this instead: <nml:link id="urn:ogf:network:example.net:link_A-to-C"> <nml:relation type="serialcompound"> ... </nml:relation> </nml:link> Your example above would not parse correctly.
and:
<nml:link id="urn:ogf:network:example.net:link_A-to-C"> <nmlserialcompound:relation> ... </nmlserialcompound:relation> </nml:link>
The advantage of the first syntax is that it is very easily extendable, and it is still obvious for a parser to understand that it is some kind of nml:relation, even if the particular type of relation is not known by the parser.
The advantage of the second syntax is that it is easy to create a meaningful validator for each specific nml:relation.
I dislike both syntaxes, and was hoping for a syntax that would provide both benefits.
If I'm correct, the following syntax will do just that:
<nml:link id="urn:ogf:network:example.net:link_A-to-C"> <nml:relations> <nmlserialcompound:relation> ... </nmlserialcompound:relation> </nml:relations> </nml:link>
This adds a parent element to the relation elements, signifying that <nmlserialcompound:relation> is indeed a nml:relation. So even a parser that has no knowledge about this particular nml:relation still knows it's base syntax, while a parser that understands the details can still use an meaningful syntax validator (such as XSD) to make sure the syntax is correct.
The solution with namespaces gives you that (nmlserialcompound:relation inherits from the base nml:relation). nml:relations only complicates the xml structure without giving too much.
I agree with Roman, the use of the 'relations' element is really not necessary here. I am still not clear why you believe this element is necessary. It is a 'grouping' concept from what I can tell, but this does not add any inheritance into the sub elements except that of parent/child. The concept of namepsaces gives you the inheritance that I think you want. -jason
Cheers, Roman
Would this do, and is this syntax acceptable to all?
Regards, Freek