I don't see why order of elements is significant but not the case for attributes.
Can any one provide a sound reason?
element addressBook {
element card {
attribute name { text },
attribute email { text }
}*
}
In XML, the order of attributes is traditionally not significant. RELAX NG follows this tradition. The above pattern would match both
<card name="John Smith" email="[email protected]"/>
and
<card email="[email protected]" name="John Smith"/>
In contrast, the order of elements is significant. The pattern
element card {
element name { text },
element email { text }
}
would not match
<card><email>[email protected]</email><name>John Smith</name></card>
And what about this one:
If the children of an element or an attribute match a datatype pattern, then the complete content of the element or attribute must match that datatype pattern. It is not permitted to have a pattern which allows part of the content to match a datatype pattern, and another part to match another pattern. For example, the following pattern is not allowed:
element bad {
xsd:int,
element note { text }
}
However, this would be fine:
element ok {
xsd:int,
attribute note { text }
}
Note that this restriction does not apply to the text pattern.