code_junkie

How to declare special XML schema (XSD) case

Nov 13th, 2011
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <x>stuff</x>
  2. <y>stuff</y>
  3. <x>stuff</x>
  4.  
  5. <y>stuff</y>
  6. <x>stuff</x>
  7. <x>stuff</x>
  8.  
  9. <x>stuff</x>
  10. <x>stuff</x>
  11. <y>stuff</y>
  12. <x>stuff</x>
  13.  
  14. <xs:complexType name="myComplexType">
  15. <xs:sequence>
  16. <xs:element name="x" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  17. <xs:sequence minOccurs="0">
  18. <xs:element name="y" type="xs:string"/>
  19. <xs:element name="x" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  20. </xs:sequence>
  21. </xs:sequence>
  22. </xs:complexType>
  23.  
  24. <xs:complexType name="myComplexType">
  25. <xs:all>
  26. <xs:element name="x" type="xs:string" maxOccurs="unbounded"/>
  27. <xs:element name="y" type="xs:string" maxOccurs="1"/>
  28. </xs:all>
  29. </xs:complexType>
  30.  
  31. <xsd:element name="parent">
  32. <xsd:complexType>
  33. <xsd:choice maxOccurs="unbounded">
  34. <xsd:element name="x" type="xs:string"/>
  35. <xsd:sequence>
  36. <xsd:element name="y" type="xsd:string" />
  37. <xsd:element name="x" type="xsd:string" />
  38. </xsd:sequence>
  39. </xsd:choice>
  40. </xsd:complexType>
  41. </xsd:element>
  42.  
  43. <xs:element name="x" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  44. <xs:element name="y" type="xs:string" minOccurs="0" maxOccurs="1"/>
  45. <xs:element name="x" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
Add Comment
Please, Sign In to add comment