Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  2. <xs:annotation>
  3. <xs:documentation xml:lang="pl">
  4. Przykład schematu z zagnieżdżonymi wyborami i sekwencjami. Elementy i typy zupełnie sztuczne.
  5. </xs:documentation>
  6. </xs:annotation>
  7.  
  8. <!-- Definicje elementów. -->
  9. <xs:element name="Start" type="xs:string"/>
  10. <xs:element name="A" type="xs:string"/>
  11. <xs:element name="B" type="xs:string"/>
  12. <xs:element name="C" type="xs:string"/>
  13. <xs:element name="Koniec" type="xs:string"/>
  14.  
  15. <!-- Definicjwe typów. -->
  16. <xs:complexType name="typ1">
  17. <xs:annotation>
  18. <xs:documentation xml:lang="pl">
  19. Dokładnie jeden element B lub od 2 do 3 elementów A oraz opcjonalnie jedem C.
  20. </xs:documentation>
  21. </xs:annotation>
  22. <xs:choice>
  23. <xs:element ref="A" minOccurs="2" maxOccurs="3"/>
  24. <xs:element ref="B" use="required"/>
  25. <xs:element ref="C" use="optional"/>
  26.  
  27. </xs:choice>
  28. </xs:complexType>
  29.  
  30. <xs:complexType name="typ2">
  31. <xs:annotation>
  32. <xs:documentation xml:lang="pl">
  33.  
  34. </xs:documentation>
  35. </xs:annotation>
  36. <xs:sequence>
  37. <xs:element ref="Start"/>
  38. <xs:choice minOccurs="0" maxOccurs="unbounded">
  39. <xs:element ref="A" use="required"/>
  40. <xs:sequence>
  41. <xs:element ref="B" minOccurs="2" maxOccurs="2"/>
  42. <xs:element ref="C" minOccurs="3" maxOccurs="3"/>
  43. </xs:sequence>
  44. </xs:choice>
  45. <xs:element ref="Koniec"/>
  46. </xs:sequence>
  47. </xs:complexType>
  48.  
  49. <!-- Tu dopisz nowe definicje typów -->
  50.  
  51. <xs:complexType name="typ3">
  52. <xs:annotation>
  53. <xs:documentation xml:lang="pl">
  54. Wybór między parzystą liczba elementów lub podzielną przez 3 A.
  55. </xs:documentation>
  56. </xs:annotation>
  57. <xs:sequence use="required">
  58. <xs:choice minOccurs="0" maxOccurs="unbounded">
  59. <xs:element ref="A" minOccurs="2" maxOccurs="2"/>
  60. </xs:choice>
  61.  
  62. <xs:choice minOccurs="0" maxOccurs="unbounded">
  63. <xs:element ref="A" minOccurs="3" maxOccurs="3"/>
  64. </xs:choice>
  65. </xs:sequence>
  66. </xs:complexType>
  67.  
  68. <xs:complexType name="typ4">
  69. <xs:annotation>
  70. <xs:documentation xml:lang="pl">
  71. Elementy A,B I C w dowolnej kolejności.
  72. </xs:documentation>
  73. </xs:annotation>
  74. <xs:all minOccurs="0" maxOccurs="unbounded">
  75. <xs:element ref="A" use="required"/>
  76. <xs:element ref="B" use="required"/>
  77. <xs:element ref="C" use="optional"/>
  78. </xs:all>
  79. </xs:complexType>
  80.  
  81. <xs:complexType name="typ5">
  82. <xs:annotation>
  83. <xs:documentation xml:lang="pl">
  84. Od2-3 element A, jeden element B i opcjonalny C.
  85. </xs:documentation>
  86. </xs:annotation>
  87. <xs:all minOccurs="0" maxOccurs="unbounded">
  88. <xs:element ref="A" minOccurs="2" maxOccurs="3"/>
  89. <xs:element ref="B" use="required"/>
  90. <xs:element ref="C" use="optional"/>
  91. </xs:all>
  92. </xs:complexType>
  93.  
  94.  
  95. <xs:element name="root" type="typ1"/>
  96. </xs:schema>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement