xml - XSD validation - ANY in SEQUENCE ("Unique Particle Attribution") -
i have following xsd schema:
<xsd:schema xmlns="http://www.mynamespace.test/" xmlns:xsd="http://www.w3.org/2001/xmlschema" targetnamespace="http://www.mynamespace.test/" elementformdefault="qualified" attributeformdefault="unqualified"> <xsd:include schemalocation="../components.xsd"/> <xsd:element name="po" type="potype"/> <xsd:complextype name="potype"> <xsd:sequence> <xsd:element ref="pa" maxoccurs="unbounded"/> <xsd:element ref="pb" maxoccurs="unbounded"/> <xsd:any minoccurs="0" /> </xsd:sequence> <xsd:attributegroup ref="someattrgroup"/> <xsd:attributegroup ref="someotherattrgroup"/> </xsd:complextype> </xsd:schema>
where want make sure po element contains pa elements , pb elements (pa before pb), there kind of elements allowed in front of pa, in between pa , pb , after pb... tried adding xsd:any @ places, 1 of them not possible because of "unique particle attribution".
i understand why raises error (can't tell difference between existing pb element belong part or actual pb in sequence). see no way of how achieve want: possible @ all, , how done?
ps: elements can in same namespace pa , pb elements, not pa/pb elements itself.
where want make sure po element contains pa elements , pb elements (pa before pb), there kind of elements allowed in front of pa, in between pa , pb , after pb...
you cannot in xsd 1.0, can in xsd 1.1 because of relaxed unique particle attribution requirements:
<xsd:schema xmlns="http://www.mynamespace.test/" xmlns:xsd="http://www.w3.org/2001/xmlschema" targetnamespace="http://www.mynamespace.test/" elementformdefault="qualified" attributeformdefault="unqualified" xmlns:vc="http://www.w3.org/2007/xmlschema-versioning" vc:minversion="1.1"> <xsd:include schemalocation="../components.xsd"/> <xsd:element name="po" type="potype"/> <xsd:complextype name="potype"> <xsd:sequence> <xsd:any minoccurs="0" /> <xsd:element ref="pa" maxoccurs="unbounded"/> <xsd:any minoccurs="0" /> <xsd:element ref="pb" maxoccurs="unbounded"/> <xsd:any minoccurs="0" /> </xsd:sequence> <xsd:attributegroup ref="someattrgroup"/> <xsd:attributegroup ref="someotherattrgroup"/> </xsd:complextype> </xsd:schema>
Comments
Post a Comment