1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Copyright (C) 2012 The Android Open Source Project
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8          http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15-->
16<schema xmlns="http://www.w3.org/2001/XMLSchema"
17    xmlns:tns="http://schemas.android.com/service/camera/metadata/"
18    targetNamespace="http://schemas.android.com/service/camera/metadata/"
19    elementFormDefault="qualified">
20
21    <element name="metadata" type="tns:MetadataType">
22        <key name="TypeNameKey">
23            <selector xpath="tns:types/tns:typedef" />
24            <field xpath="@name" />
25        </key>
26
27        <!-- ensure that <entry typedef="..."> refers to a valid <typedef name='..."/> -->
28        <keyref name="TypeNameKeyRef" refer="tns:TypeNameKey">
29            <selector xpath=".//tns:entry" /> <!-- recursively find any descendant entry -->
30            <field xpath="@typedef" />
31        </keyref>
32    </element>
33
34    <complexType name="MetadataType">
35        <sequence>
36            <element name="tags" type="tns:TagsType" maxOccurs="1" minOccurs="0"></element>
37            <element name="types" type="tns:TypesType" maxOccurs="1" minOccurs="0"></element>
38            <element name="namespace" type="tns:NamespaceType"
39                maxOccurs="unbounded" minOccurs="1">
40            </element>
41        </sequence>
42    </complexType>
43
44    <complexType name="NamespaceType">
45        <sequence>
46            <element name="section" type="tns:SectionType" maxOccurs="unbounded" minOccurs="1"></element>
47        </sequence>
48        <attribute name="name" type="string" use="required"></attribute>
49    </complexType>
50
51    <complexType name="SectionType">
52        <sequence>
53            <choice maxOccurs="unbounded">
54                <element name="controls" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
55                <element name="static" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
56                <element name="dynamic" type="tns:SectionKindType" maxOccurs="unbounded" minOccurs="0"></element>
57            </choice>
58        </sequence>
59        <attribute name="name" type="string" use="required"></attribute>
60    </complexType>
61
62    <complexType name="SectionKindType">
63        <complexContent>
64            <extension base="tns:BaseNamespaceOrSectionKindType">
65            </extension>
66        </complexContent>
67    </complexType>
68
69    <complexType name="InnerNamespaceType">
70        <complexContent>
71            <extension base="tns:BaseNamespaceOrSectionKindType">
72                <attribute name="name" type="string" use="required"></attribute>
73            </extension>
74        </complexContent>
75    </complexType>
76
77    <complexType name="BaseNamespaceOrSectionKindType">
78        <sequence maxOccurs="unbounded">
79            <choice>
80                <element name="namespace" type="tns:InnerNamespaceType"></element>
81                <element name="entry" type="tns:EntryType"></element>
82                <element name="clone" type="tns:CloneType"></element>
83            </choice>
84        </sequence>
85    </complexType>
86
87    <complexType name="TagsType">
88        <sequence>
89            <element name="tag" type="tns:TagType" maxOccurs="unbounded" minOccurs="0"></element>
90        </sequence>
91    </complexType>
92
93    <complexType name="TagType">
94        <simpleContent>
95            <extension base="string">
96                <attribute name="id" type="string" use="required"></attribute>
97            </extension>
98        </simpleContent>
99    </complexType>
100
101    <complexType name="TypesType">
102        <sequence>
103            <element name="typedef" type="tns:TypedefType" maxOccurs="unbounded" minOccurs="0">
104            </element>
105        </sequence>
106    </complexType>
107
108    <complexType name="TypedefType">
109        <sequence>
110            <element name="language" type="tns:LanguageType" maxOccurs="unbounded" minOccurs="1"></element>
111        </sequence>
112        <attribute name="name" type="string" use="required" />
113    </complexType>
114
115    <complexType name="LanguageType">
116        <simpleContent>
117            <extension base="string">
118                <attribute name="name" use="required">
119                    <simpleType>
120                        <restriction base="string">
121                            <enumeration value="java" />
122                            <enumeration value="c" />
123                            <enumeration value="c++" />
124                        </restriction>
125                    </simpleType>
126                </attribute>
127            </extension>
128        </simpleContent>
129    </complexType>
130
131    <group name="BaseEntryGroup">
132        <sequence>
133            <element name="description" type="string" maxOccurs="1"
134                minOccurs="0">
135            </element>
136            <element name="units" type="string" maxOccurs="1"
137                minOccurs="0">
138            </element>
139            <element name="range" type="string" maxOccurs="1"
140                minOccurs="0">
141            </element>
142            <element name="details" type="string" maxOccurs="1"
143                minOccurs="0">
144            </element>
145            <element name="hal_details" type="string" maxOccurs="1"
146                minOccurs="0">
147            </element>
148
149            <element name="tag" type="tns:TagType" maxOccurs="unbounded"
150                minOccurs="0">
151            </element>
152        </sequence>
153    </group>
154
155    <complexType name="EntryType">
156        <sequence>
157            <element name="array" type="tns:ArrayType" maxOccurs="1" minOccurs="0"></element>
158            <element name="enum" type="tns:EnumType" maxOccurs="1" minOccurs="0"></element>
159            <element name="tuple" type="tns:TupleType" maxOccurs="1" minOccurs="0"></element>
160
161            <group ref="tns:BaseEntryGroup" />
162        </sequence>
163
164        <attribute name="name" type="string" use="required" />
165        <attribute name="type" use="required">
166            <simpleType>
167                <restriction base="string">
168                    <enumeration value="byte" />
169                    <enumeration value="int32" />
170                    <enumeration value="int64" />
171                    <enumeration value="float" />
172                    <enumeration value="double" />
173                    <enumeration value="rational" />
174                </restriction>
175            </simpleType>
176        </attribute>
177        <attribute name="type_notes" type="string" />
178        <attribute name="container">
179            <simpleType>
180                <restriction base="string">
181                    <enumeration value="array" />
182                    <enumeration value="tuple" />
183                </restriction>
184            </simpleType>
185        </attribute>
186        <attribute name="enum">
187            <simpleType>
188                <restriction base="string">
189                    <enumeration value="true"></enumeration>
190                    <enumeration value="false"></enumeration>
191                </restriction>
192            </simpleType>
193        </attribute>
194        <attribute name="visibility">
195            <simpleType>
196                <restriction base="string">
197                    <enumeration value="system" /> <!-- do not expose to java/NDK API -->
198                    <enumeration value="java_public" /> <!-- java as public SDK. Not included in NDK -->
199                    <enumeration value="ndk_public" /> <!-- public in NDK. @hide in java -->
200                    <enumeration value="hidden" /> <!-- java as @hide. Not included in NDK -->
201                    <enumeration value="public" /> <!-- public to both java and NDK -->
202                </restriction>
203            </simpleType>
204        </attribute>
205        <attribute name="synthetic" default="false">
206            <simpleType>
207                <restriction base="string">
208                    <enumeration value="false" /> <!-- expose to C -->
209                    <enumeration value="true" /> <!-- do not expose to C -->
210                </restriction>
211            </simpleType>
212        </attribute>
213        <attribute name="deprecated" default="false">
214            <simpleType>
215                <restriction base="string">
216                    <enumeration value="false" /> <!-- normal -->
217                    <enumeration value="true" /> <!-- mark @Deprecated -->
218                </restriction>
219            </simpleType>
220        </attribute>
221        <attribute name="optional" default="false">
222            <simpleType>
223                <restriction base="string">
224                    <enumeration value="false" />
225                    <enumeration value="true" />
226                </restriction>
227            </simpleType>
228        </attribute>
229        <attribute name="typedef" type="string" />
230        <attribute name="hwlevel" default="full">
231            <simpleType>
232                <restriction base="string">
233                    <enumeration value="full" />
234                    <enumeration value="limited" />
235                    <enumeration value="legacy" />
236                </restriction>
237            </simpleType>
238        </attribute>
239    </complexType>
240
241    <complexType name="EnumType">
242        <sequence>
243            <element name="value" type="tns:EnumValueType" maxOccurs="unbounded"></element>
244        </sequence>
245    </complexType>
246
247    <complexType name="TupleType">
248        <sequence>
249            <element name="value" type="string" minOccurs="1" maxOccurs="unbounded"></element>
250        </sequence>
251    </complexType>
252
253    <complexType name="ArrayType">
254        <sequence>
255            <element name="size" type="string" minOccurs="1" maxOccurs="unbounded"></element>
256        </sequence>
257    </complexType>
258
259    <complexType name="EnumValueType" mixed="true">
260
261        <sequence>
262            <element name="notes" type="string" minOccurs="0" maxOccurs="1" />
263        </sequence>
264
265        <attribute name="deprecated" default="false">
266            <simpleType>
267                <restriction base="string">
268                    <enumeration value="true"></enumeration>
269                    <enumeration value="false"></enumeration>
270                </restriction>
271            </simpleType>
272        </attribute>
273        <attribute name="optional">
274            <simpleType>
275                <restriction base="string">
276                    <enumeration value="true"></enumeration>
277                    <enumeration value="false"></enumeration>
278                </restriction>
279            </simpleType>
280        </attribute>
281        <attribute name="hidden">
282            <simpleType>
283                <restriction base="string">
284                    <enumeration value="true"></enumeration>
285                    <enumeration value="false"></enumeration>
286                </restriction>
287            </simpleType>
288        </attribute>
289        <attribute name="ndk_hidden">
290            <simpleType>
291                <restriction base="string">
292                    <enumeration value="true"></enumeration>
293                    <enumeration value="false"></enumeration>
294                </restriction>
295            </simpleType>
296        </attribute>
297        <attribute name="id" type="string" />
298    </complexType>
299
300    <complexType name="CloneType">
301        <sequence>
302                <group ref="tns:BaseEntryGroup" />
303        </sequence>
304
305        <!--
306             the semantic correctness of the next 2 attributes
307             are validated by metadata_validate.py
308
309             due to the inability of XSD to generate paths recursively
310        -->
311        <attribute name="entry">
312        </attribute>
313        <attribute name="kind">
314            <simpleType>
315                <restriction base="string">
316                    <enumeration value="controls"></enumeration>
317                    <enumeration value="static"></enumeration>
318                    <enumeration value="dynamic"></enumeration>
319                </restriction>
320            </simpleType>
321        </attribute>
322    </complexType>
323</schema>
324