3 /******************************************************************************
4 * $Id: nitf_spec.xsd 22867 2011-08-06 13:47:27Z rouault $
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>
10 **********************************************************************
11 * Copyright (c) 2011, Even Rouault
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:
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
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 ****************************************************************************/
32 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
33 <xs:element name="tres">
36 <xs:element name="tre" type="treType" minOccurs="0" maxOccurs="unbounded"/>
41 <xs:complexType name="treType">
42 <xs:group ref="itemType"/>
43 <xs:attribute name="name" type="xs:string"/>
44 <xs:attribute name="md_prefix" type="xs:string" use="optional"/>
45 <xs:attribute name="length" type="positiveInteger" use="optional"/>
46 <xs:attribute name="minlength" type="xs:integer" use="optional"/>
47 <xs:attribute name="maxlength" type="xs:integer" use="optional"/>
48 <xs:attribute name="location" type="xs:string" use="optional"/>
51 <xs:group name="itemType">
53 <xs:choice minOccurs="0" maxOccurs="unbounded">
54 <xs:element name="field" type="fieldType">
56 <xs:selector xpath="."/>
57 <xs:field xpath="@length|@length_var"/>
60 <xs:element name="loop" type="loopType">
62 <xs:selector xpath="."/>
63 <xs:field xpath="@counter|@iterations|@formula"/>
66 <xs:element name="if" type="ifType"/>
68 <xs:element name="if_remaining_bytes" type="if_remaining_bytesType" minOccurs="0" maxOccurs="1"/>
72 <xs:complexType name="loopType">
73 <xs:group ref="itemType"/>
74 <xs:attribute name="name"/>
76 <xs:attribute name="counter" type="xs:string"/>
77 <xs:attribute name="iterations" type="positiveInteger"/>
78 <xs:attribute name="formula">
80 <xs:restriction base="xs:string">
81 <xs:enumeration value="(NPART+1)*(NPART)/2"/>
82 <xs:enumeration value="(NUMOPG+1)*(NUMOPG)/2"/>
83 <xs:enumeration value="NPAR*NPARO"/>
84 <xs:enumeration value="NPLN-1"/>
85 <xs:enumeration value="NXPTS*NYPTS"/>
90 <xs:attribute name="md_prefix" use="optional">
92 <xs:restriction base="xs:string">
93 <xs:pattern value="([a-z]|[A-Z]|[0-9]|_)*(%[0-9]*d)?([a-z]|[A-Z]|[0-9]|_)*"/>
99 <xs:simpleType name="positiveInteger">
100 <xs:restriction base="xs:integer">
101 <xs:minInclusive value="1"/>
105 <xs:complexType name="ifType">
106 <xs:group ref="itemType"/>
107 <xs:attribute name="cond">
109 <xs:restriction base="xs:string">
110 <xs:pattern value=".+[!]?=.*"/>
116 <xs:complexType name="if_remaining_bytesType">
117 <xs:group ref="itemType"/>
120 <xs:complexType name="fieldType">
122 <xs:attribute name="length" type="positiveInteger"/>
123 <xs:attribute name="length_var" type="xs:string"/>
125 <xs:attribute name="name" type="xs:string" use="optional"/>
126 <xs:attribute name="longname" type="xs:string" use="optional"/>
127 <xs:attribute name="type" use="optional">
129 <xs:restriction base="xs:string">
130 <xs:enumeration value="string"/>
131 <xs:enumeration value="integer"/>
132 <xs:enumeration value="real"/>
136 <xs:attribute name="unit" type="xs:string" use="optional"/>
137 <xs:attribute name="minval" use="optional"/>
138 <xs:attribute name="maxval" use="optional"/>
139 <xs:attribute name="fixed_value" use="optional"/>
140 <!--<xs:anyAttribute/>-->