XSD selection inside everything

You cannot put a select tag in all tags. So, is there any workaround for getting this function? For example, I have a <settings> , for example:

 <settings> <logging /> <sending /> <useonly /> </settings> 

Or something like

 <settings> <logging /> <notuseonly /> <sending /> </settings> 

Therefore, I want to prevent the display of <useonly> and <notuseonly> , while the order is not important. And if allowed, in XSD it will look like this:

  <xs:all> <xs:element minOccurs="0" maxOccurs="1" ref="sending" /> <xs:element minOccurs="0" maxOccurs="1" ref="logging" /> <xs:choice> <xs:element minOccurs="0" maxOccurs="1" ref ="useonly" /> <xs:element minOccurs="0" maxOccurs="1" ref ="notuseonly" /> </xs:choice> </xs:all> 

Any thoughts?

+4
source share
1 answer

Check out this link: http://www.w3.org/wiki/Needs_choice_inside_all

I summarize the proposed solutions for you:

One solution is to wrap an element that can change inside another:

  <xsd:all> <xsd:element minOccurs="0" maxOccurs="1" ref="sending" /> <xsd:element minOccurs="0" maxOccurs="1" ref="logging"/> <xsd:element minOccurs="0" maxOccurs="1" ref ="usetype"/> </xsd:all> <xsd:element name="usetype"> <xsd:complexType> <xsd:choice> <xsd:element ref="useonly"/> <xsd:element ref="notuseonly"/> </xsd:choice> </xsd:complexType> </xsd:element> 

Another is to use a lookup group:

  <xsd:all> <xsd:element ref="sending"/> <xsd:element ref="logging"/> <xsd:element ref="usetype"/> </xsd:all> </xsd:complexType> <xsd:element name="usetype" abstract="true"/> <xsd:element name="useonly" substitutionGroup="usetype"> ... </xsd:element> <xsd:element name="notuseonly" substitutionGroup="usetype"> ... </xsd:element> 
+7
source

All Articles