So I\'m writing a new XSD and I\'ve come across a little issue. Now I\'ll admit I\'m not the best with these, but I would have thought what I have done should have worked bu
See @IanRoberts fine suggestion in the comments regarding asserting that no grandchild elements exist under the children of extraInfo
.
If you want more control over the type of the extraInfo
child elements, you'll have to specify their names a priori.
Attributes
Or, why not leverage the fact that attribute values already are constrained not to have subelements and use xsd:anyAttribute
instead:
Users could then add extraInfo
along these lines:
and
which would be natural given that you wish to allow only string values.
Elements (update per OP question in comments)
If the max of 42 constraint is important to you, you could go meta with a structure such as
Then you could restrict the number of item
elements trivially in XSD 1.0 via @maxOccurs
.