Project

Profile

Help

Download (5.22 KB) Statistics
| Branch: | Tag: | Revision:

he / latest9.9 / hej / net / sf / saxon / data / json.xsd @ 83c0eb4c

1 9eaff9ee O'Neil Delpratt
<?xml version="1.0" encoding="UTF-8"?>
2
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
3
    elementFormDefault="qualified"
4
    targetNamespace="http://www.w3.org/2005/xpath-functions"
5
    xmlns:j="http://www.w3.org/2005/xpath-functions">
6
    
7
    <!-- 
8
     * This is a schema for the XML representation of JSON used as the target for the
9
     * function fn:json-to-xml()
10
     *
11
     * The schema is made available under the terms of the W3C software notice and license
12
     * at http://www.w3.org/Consortium/Legal/copyright-software-19980720
13
     *
14
    -->
15
    
16
    <xs:element name="map" type="j:mapType">
17
        <xs:unique name="unique-key">
18
            <xs:selector xpath="*"/>
19
            <xs:field xpath="@key"/>
20
        </xs:unique>
21
    </xs:element>
22
    
23
    <xs:element name="array" type="j:arrayType"/>
24
    
25
    <xs:element name="string" type="j:stringType"/>
26
    
27
    <xs:element name="number" type="j:numberType"/>
28
    
29
    <xs:element name="boolean" type="j:booleanType"/>
30
    
31
    <xs:element name="null" type="j:nullType"/>
32
    
33
    <xs:complexType name="nullType">
34
        <xs:sequence/>
35
        <xs:anyAttribute processContents="skip" namespace="##other"/>
36
    </xs:complexType>
37
    
38
    <xs:complexType name="booleanType">
39
        <xs:simpleContent>
40
            <xs:extension base="xs:boolean">
41
                <xs:anyAttribute processContents="skip" namespace="##other"/>
42
            </xs:extension>
43
        </xs:simpleContent>
44
    </xs:complexType>
45
    
46
    <xs:complexType name="stringType">
47
        <xs:simpleContent>
48
            <xs:extension base="xs:string">
49
                <xs:attribute name="escaped" type="xs:boolean" use="optional" default="false"/>
50
                <xs:anyAttribute processContents="skip" namespace="##other"/>
51
            </xs:extension>
52
        </xs:simpleContent>
53
    </xs:complexType>
54
    
55
    <xs:simpleType name="finiteNumberType">
56
        <xs:restriction base="xs:double">
57
            <!-- exclude positive and negative infinity, and NaN -->
58
            <xs:minExclusive value="-INF"/>
59
            <xs:maxExclusive value="INF"/>
60
        </xs:restriction>
61
    </xs:simpleType>
62
    
63
    <xs:complexType name="numberType">
64
        <xs:simpleContent>
65
            <xs:extension base="j:finiteNumberType">
66
                <xs:anyAttribute processContents="skip" namespace="##other"/>
67
            </xs:extension>
68
        </xs:simpleContent>
69
    </xs:complexType>
70
    
71
    <xs:complexType name="arrayType">
72
        <xs:choice minOccurs="0" maxOccurs="unbounded">
73
            <xs:element ref="j:map"/>
74
            <xs:element ref="j:array"/>
75
            <xs:element ref="j:string"/>
76
            <xs:element ref="j:number"/>
77
            <xs:element ref="j:boolean"/>
78
            <xs:element ref="j:null"/>
79
        </xs:choice>
80
        <xs:anyAttribute processContents="skip" namespace="##other"/>
81
    </xs:complexType>
82
    
83
    <xs:complexType name="mapWithinMapType">
84
        <xs:complexContent>
85
            <xs:extension base="j:mapType">
86
                <xs:attributeGroup ref="j:key-group"/>
87
            </xs:extension>
88
        </xs:complexContent>
89
    </xs:complexType>
90
    
91
    <xs:complexType name="arrayWithinMapType">
92
        <xs:complexContent>
93
            <xs:extension base="j:arrayType">
94
                <xs:attributeGroup ref="j:key-group"/>
95
            </xs:extension>
96
        </xs:complexContent>
97
    </xs:complexType>
98
    
99
    <xs:complexType name="stringWithinMapType">
100
        <xs:simpleContent>
101
            <xs:extension base="j:stringType">
102
                <xs:attributeGroup ref="j:key-group"/>
103
            </xs:extension>
104
        </xs:simpleContent>
105
    </xs:complexType>
106
    
107
    <xs:complexType name="numberWithinMapType">
108
        <xs:simpleContent>
109
            <xs:extension base="j:numberType">
110
                <xs:attributeGroup ref="j:key-group"/>
111
            </xs:extension>
112
        </xs:simpleContent>
113
    </xs:complexType>
114
    
115
    <xs:complexType name="booleanWithinMapType">
116
        <xs:simpleContent>
117
            <xs:extension base="j:booleanType">
118
                <xs:attributeGroup ref="j:key-group"/>
119
            </xs:extension>
120
        </xs:simpleContent>
121
    </xs:complexType>
122
    
123
    <xs:complexType name="nullWithinMapType">
124
        <xs:attributeGroup ref="j:key-group"/>
125
    </xs:complexType>
126
    
127
    <xs:complexType name="mapType">
128
        <xs:choice minOccurs="0" maxOccurs="unbounded">
129
            <xs:element name="map" type="j:mapWithinMapType">
130
                <xs:unique name="unique-key-2">
131
                    <xs:selector xpath="*"/>
132
                    <xs:field xpath="@key"/>
133
                </xs:unique>
134
            </xs:element>
135
            <xs:element name="array" type="j:arrayWithinMapType"/>            
136
            <xs:element name="string" type="j:stringWithinMapType"/>   
137
            <xs:element name="number" type="j:numberWithinMapType"/>
138
            <xs:element name="boolean" type="j:booleanWithinMapType"/>
139
            <xs:element name="null" type="j:nullWithinMapType"/>
140
        </xs:choice>
141
        <xs:anyAttribute processContents="skip" namespace="##other"/>
142
    </xs:complexType>
143
    
144
    <xs:attributeGroup name="key-group">
145
        <xs:attribute name="key" type="xs:string"/>
146
        <xs:attribute name="escaped-key" type="xs:boolean" use="optional" default="false"/>
147
    </xs:attributeGroup>
148
    
149
</xs:schema>