Reputation: 400
I have the following choice sequence as part of an XML schema. Ideally, I want a sequence where either:
my:namespace
must be strictly parsed.##targetNamespace
and my:namespace
, should be skipped during parsing/validation.<xs:sequence>
<xs:choice>
<xs:any namespace="my:namespace"/>
<xs:any namespace="##other" processContents="skip"/>
</xs:choice>
</xs:sequence>
However, of course, this schema is invalid: my:namespace
is a member of ##other
, so parsing is ambiguous. Attempting to use this schema yields a unique particle attribution violation. Is there any other way to achieve what I've described?
Upvotes: 0
Views: 63
Reputation: 163262
XSD 1.1 allows xs:any
to have an explicit list of namespaces to be included or excluded.
So many questions follow the pattern "can I do this in XSD" and have the answer "yes, but you need XSD 1.1"...
Upvotes: 1