vdv-first4_0.xsd 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- $Header: /home/cvsroot/w3c-xml-schema/user/examples/first-complex-types.xsd,v 1.1 2001/11/12 20:54:00 vdv Exp $ -->
  3. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  4. <xs:simpleType name="string255">
  5. <xs:restriction base="xs:token">
  6. <xs:maxLength value="255"/>
  7. </xs:restriction>
  8. </xs:simpleType>
  9. <xs:simpleType name="string32">
  10. <xs:restriction base="xs:token">
  11. <xs:maxLength value="32"/>
  12. </xs:restriction>
  13. </xs:simpleType>
  14. <xs:simpleType name="isbn">
  15. <xs:restriction base="xs:unsignedLong">
  16. <xs:totalDigits value="10"/>
  17. <xs:pattern value="\d{10}"/>
  18. </xs:restriction>
  19. </xs:simpleType>
  20. <xs:simpleType name="bookID">
  21. <xs:restriction base="xs:ID">
  22. <xs:pattern value="b\d{10}"/>
  23. </xs:restriction>
  24. </xs:simpleType>
  25. <xs:simpleType name="supportedLanguages">
  26. <xs:restriction base="xs:language">
  27. <xs:enumeration value="en"/>
  28. <xs:enumeration value="es"/>
  29. </xs:restriction>
  30. </xs:simpleType>
  31. <xs:simpleType name="date">
  32. <xs:restriction base="xs:date">
  33. <xs:pattern value="[^:Z]*"/>
  34. </xs:restriction>
  35. </xs:simpleType>
  36. <xs:element name="name" type="string32"/>
  37. <xs:element name="qualification" type="string255"/>
  38. <xs:element name="born" type="date"/>
  39. <xs:element name="dead" type="date"/>
  40. <xs:element name="isbn" type="isbn"/>
  41. <xs:attribute name="id" type="xs:ID"/>
  42. <xs:attribute name="available" type="xs:boolean"/>
  43. <xs:attribute name="lang" type="supportedLanguages"/>
  44. <xs:complexType name="elementWithID">
  45. <xs:attribute ref="id"/>
  46. </xs:complexType>
  47. <xs:complexType name="bookTmp">
  48. <xs:complexContent>
  49. <xs:extension base="elementWithID">
  50. <xs:sequence>
  51. <xs:element ref="isbn"/>
  52. <xs:element ref="title"/>
  53. <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
  54. <xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/>
  55. </xs:sequence>
  56. <xs:attribute ref="available"/>
  57. </xs:extension>
  58. </xs:complexContent>
  59. </xs:complexType>
  60. <xs:complexType name="personType">
  61. <xs:complexContent>
  62. <xs:extension base="elementWithID">
  63. <xs:sequence>
  64. <xs:element ref="name"/>
  65. <xs:element ref="born"/>
  66. <xs:element ref="dead" minOccurs="0"/>
  67. <xs:element ref="qualification" minOccurs="0"/>
  68. </xs:sequence>
  69. </xs:extension>
  70. </xs:complexContent>
  71. </xs:complexType>
  72. <xs:element name="title">
  73. <xs:complexType>
  74. <xs:simpleContent>
  75. <xs:extension base="string255">
  76. <xs:attribute ref="lang"/>
  77. </xs:extension>
  78. </xs:simpleContent>
  79. </xs:complexType>
  80. </xs:element>
  81. <xs:element name="library">
  82. <xs:complexType>
  83. <xs:sequence>
  84. <xs:element ref="book" maxOccurs="unbounded"/>
  85. </xs:sequence>
  86. </xs:complexType>
  87. </xs:element>
  88. <xs:element name="book">
  89. <xs:complexType>
  90. <xs:complexContent>
  91. <xs:restriction base="bookTmp">
  92. <xs:sequence>
  93. <xs:element ref="isbn"/>
  94. <xs:element ref="title"/>
  95. <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
  96. <xs:element ref="character" minOccurs="0" maxOccurs="unbounded"/>
  97. </xs:sequence>
  98. <xs:attribute name="id" type="bookID"/>
  99. <xs:attribute ref="available"/>
  100. </xs:restriction>
  101. </xs:complexContent>
  102. </xs:complexType>
  103. </xs:element>
  104. <xs:element name="author">
  105. <xs:complexType>
  106. <xs:complexContent>
  107. <xs:restriction base="personType">
  108. <xs:sequence>
  109. <xs:element ref="name"/>
  110. <xs:element ref="born"/>
  111. <xs:element ref="dead" minOccurs="0"/>
  112. </xs:sequence>
  113. <xs:attribute ref="id"/>
  114. </xs:restriction>
  115. </xs:complexContent>
  116. </xs:complexType>
  117. </xs:element>
  118. <xs:element name="character">
  119. <xs:complexType>
  120. <xs:complexContent>
  121. <xs:restriction base="personType">
  122. <xs:sequence>
  123. <xs:element ref="name"/>
  124. <xs:element ref="born"/>
  125. <xs:element ref="qualification"/>
  126. </xs:sequence>
  127. <xs:attribute ref="id"/>
  128. </xs:restriction>
  129. </xs:complexContent>
  130. </xs:complexType>
  131. </xs:element>
  132. </xs:schema>