nitf_spec.xsd 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?xml version="1.0"?>
  2. <!--
  3. /******************************************************************************
  4. * $Id: nitf_spec.xsd 22867 2011-08-06 13:47:27Z rouault $
  5. *
  6. * Project: NITF Library
  7. * Purpose: Schema of description of NITF TREs
  8. * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
  9. *
  10. **********************************************************************
  11. * Copyright (c) 2011, Even Rouault
  12. *
  13. * Permission is hereby granted, free of charge, to any person obtaining a
  14. * copy of this software and associated documentation files (the "Software"),
  15. * to deal in the Software without restriction, including without limitation
  16. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  17. * and/or sell copies of the Software, and to permit persons to whom the
  18. * Software is furnished to do so, subject to the following conditions:
  19. *
  20. * The above copyright notice and this permission notice shall be included
  21. * in all copies or substantial portions of the Software.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  24. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  25. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  26. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  27. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  28. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  29. * DEALINGS IN THE SOFTWARE.
  30. ****************************************************************************/
  31. -->
  32. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  33. <xs:element name="tres">
  34. <xs:complexType>
  35. <xs:sequence>
  36. <xs:element name="tre" type="treType" minOccurs="0" maxOccurs="unbounded"/>
  37. </xs:sequence>
  38. </xs:complexType>
  39. </xs:element>
  40. <xs:complexType name="treType">
  41. <xs:group ref="itemType"/>
  42. <xs:attribute name="name" type="xs:string"/>
  43. <xs:attribute name="md_prefix" type="xs:string" use="optional"/>
  44. <xs:attribute name="length" type="positiveInteger" use="optional"/>
  45. <xs:attribute name="minlength" type="xs:integer" use="optional"/>
  46. <xs:attribute name="maxlength" type="xs:integer" use="optional"/>
  47. <xs:attribute name="location" type="xs:string" use="optional"/>
  48. </xs:complexType>
  49. <xs:group name="itemType">
  50. <xs:sequence>
  51. <xs:choice minOccurs="0" maxOccurs="unbounded">
  52. <xs:element name="field" type="fieldType">
  53. <xs:key name="att1">
  54. <xs:selector xpath="."/>
  55. <xs:field xpath="@length|@length_var"/>
  56. </xs:key>
  57. </xs:element>
  58. <xs:element name="loop" type="loopType">
  59. <xs:key name="att2">
  60. <xs:selector xpath="."/>
  61. <xs:field xpath="@counter|@iterations|@formula"/>
  62. </xs:key>
  63. </xs:element>
  64. <xs:element name="if" type="ifType"/>
  65. </xs:choice>
  66. <xs:element name="if_remaining_bytes" type="if_remaining_bytesType" minOccurs="0" maxOccurs="1"/>
  67. </xs:sequence>
  68. </xs:group>
  69. <xs:complexType name="loopType">
  70. <xs:group ref="itemType"/>
  71. <xs:attribute name="name"/>
  72. <!-- xs:choice -->
  73. <xs:attribute name="counter" type="xs:string"/>
  74. <xs:attribute name="iterations" type="positiveInteger"/>
  75. <xs:attribute name="formula">
  76. <xs:simpleType>
  77. <xs:restriction base="xs:string">
  78. <xs:enumeration value="(NPART+1)*(NPART)/2"/>
  79. <xs:enumeration value="(NUMOPG+1)*(NUMOPG)/2"/>
  80. <xs:enumeration value="NPAR*NPARO"/>
  81. <xs:enumeration value="NPLN-1"/>
  82. <xs:enumeration value="NXPTS*NYPTS"/>
  83. </xs:restriction>
  84. </xs:simpleType>
  85. </xs:attribute>
  86. <!-- /xs:choice -->
  87. <xs:attribute name="md_prefix" use="optional">
  88. <xs:simpleType>
  89. <xs:restriction base="xs:string">
  90. <xs:pattern value="([a-z]|[A-Z]|[0-9]|_)*(%[0-9]*d)?([a-z]|[A-Z]|[0-9]|_)*"/>
  91. </xs:restriction>
  92. </xs:simpleType>
  93. </xs:attribute>
  94. </xs:complexType>
  95. <xs:simpleType name="positiveInteger">
  96. <xs:restriction base="xs:integer">
  97. <xs:minInclusive value="1"/>
  98. </xs:restriction>
  99. </xs:simpleType>
  100. <xs:complexType name="ifType">
  101. <xs:group ref="itemType"/>
  102. <xs:attribute name="cond">
  103. <xs:simpleType>
  104. <xs:restriction base="xs:string">
  105. <xs:pattern value=".+[!]?=.*"/>
  106. </xs:restriction>
  107. </xs:simpleType>
  108. </xs:attribute>
  109. </xs:complexType>
  110. <xs:complexType name="if_remaining_bytesType">
  111. <xs:group ref="itemType"/>
  112. </xs:complexType>
  113. <xs:complexType name="fieldType">
  114. <!-- xs:choice -->
  115. <xs:attribute name="length" type="positiveInteger"/>
  116. <xs:attribute name="length_var" type="xs:string"/>
  117. <!-- /xs:choice -->
  118. <xs:attribute name="name" type="xs:string" use="optional"/>
  119. <xs:attribute name="longname" type="xs:string" use="optional"/>
  120. <xs:attribute name="type" use="optional">
  121. <xs:simpleType>
  122. <xs:restriction base="xs:string">
  123. <xs:enumeration value="string"/>
  124. <xs:enumeration value="integer"/>
  125. <xs:enumeration value="real"/>
  126. </xs:restriction>
  127. </xs:simpleType>
  128. </xs:attribute>
  129. <xs:attribute name="unit" type="xs:string" use="optional"/>
  130. <xs:attribute name="minval" use="optional"/>
  131. <xs:attribute name="maxval" use="optional"/>
  132. <xs:attribute name="fixed_value" use="optional"/>
  133. <!--<xs:anyAttribute/>-->
  134. </xs:complexType>
  135. </xs:schema>