root/WebContent/WEB-INF/resources/schemas/observer-response2.xsd @ 1058:753144867ab8

Revision 1058:753144867ab8, 5.3 KB (checked in by tgambet, 3 years ago)

changed schema to allow the status element to be at the end of the response. This makes sense for validators that construct the response sequentially and do not know at the beginning if the validation is passed or not.

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<xs:schema
3        xmlns="http://www.w3.org/2009/10/unicorn/observationresponse"
4        xmlns:xs="http://www.w3.org/2001/XMLSchema"
5        targetNamespace="http://www.w3.org/2009/10/unicorn/observationresponse"
6        elementFormDefault="qualified">
7        <xs:import
8                namespace="http://www.w3.org/XML/1998/namespace"
9                schemaLocation="http://www.w3.org/2001/xml.xsd"/>
10       
11        <xs:include schemaLocation="./xhtml/xhtml-basic10-modules-1.xsd"/>
12       
13        <!-- Simple types -->
14        <xs:simpleType name="collapseString.type">
15                <xs:restriction base="xs:string">
16                        <xs:whiteSpace value="collapse"/>
17                </xs:restriction>
18        </xs:simpleType>
19        <xs:simpleType name="range.type">
20                <xs:restriction base="xs:string">
21                        <xs:pattern value="[0-9]+-[0-9]+"/>
22                </xs:restriction>
23        </xs:simpleType>
24        <xs:simpleType name="percent.type">
25                <xs:restriction base="xs:integer">
26                        <xs:minInclusive value="0"/>
27                        <xs:maxInclusive value="100"/>
28                </xs:restriction>
29        </xs:simpleType>
30        <xs:simpleType name="message.level">
31                <xs:restriction base="xs:token">
32                        <xs:pattern value="error|warning|info"/>
33                </xs:restriction>
34        </xs:simpleType>
35
36        <!-- Complex Types -->
37        <xs:complexType name="status.type">
38                <xs:attribute name="value">
39                        <xs:simpleType>
40                                <xs:restriction base="xs:token">
41                                        <xs:pattern value="passed|failed|undef"/>
42                                </xs:restriction>
43                        </xs:simpleType>
44                </xs:attribute>
45                <xs:attribute name="rating" type="percent.type"/>
46        </xs:complexType>
47       
48        <xs:complexType mixed="true" name="description.type">
49                <xs:sequence>
50                        <xs:group ref="description.group" minOccurs="0" maxOccurs="unbounded"/>
51                </xs:sequence>
52        </xs:complexType>
53       
54        <xs:complexType name="context.type" mixed="true">
55                <xs:attribute name="line" type="xs:positiveInteger"/>
56                <xs:attribute name="column" type="xs:positiveInteger"/>
57                <xs:attribute name="line-range" type="range.type"/>
58                <xs:attribute name="column-range" type="range.type"/>
59                <xs:attribute name="offset" type="xs:positiveInteger"/>
60                <xs:attribute name="position" type="xs:string"/>
61                <xs:attribute name="ref" type="xs:anyURI"/>
62        </xs:complexType>
63
64        <xs:complexType name="message.type">
65                <xs:sequence>
66                        <xs:element name="context" type="context.type" minOccurs="0" maxOccurs="unbounded"/>
67                        <xs:element name="title" type="collapseString.type"/>
68                        <xs:element name="description" type="description.type" minOccurs="0"/>
69                </xs:sequence>
70                <xs:attribute name="ref" type="xs:anyURI"/>
71                <xs:attribute name="type" use="required" type="message.level"/>
72                <xs:attribute name="group" type="xs:token"/>
73                <xs:attribute name="level" type="percent.type"/>
74                <xs:attribute ref="xml:lang"/>
75        </xs:complexType>
76
77        <xs:complexType name="list.type">
78                <xs:sequence>
79                        <xs:element name="message" type="message.type" maxOccurs="unbounded"/>
80                </xs:sequence>
81                <xs:attribute name="ref" type="xs:anyURI"/>
82                <xs:attribute name="group" type="xs:token"/>
83        </xs:complexType>
84
85        <xs:complexType name="group.type">
86                <xs:sequence>
87                        <xs:element name="title" type="collapseString.type"/>
88                        <xs:element name="description" type="description.type" minOccurs="0"/>
89                </xs:sequence>
90                <xs:attribute name="name" type="xs:token" use="required"/>
91                <xs:attribute name="parent" type="xs:token"/>
92                <xs:attribute ref="xml:lang"/>
93        </xs:complexType>
94
95        <!-- Root element -->
96        <xs:element name="observationresponse"> 
97                <xs:complexType>
98                        <xs:sequence>
99                                <xs:element name="status" type="status.type" minOccurs="0"/>
100                                <xs:group ref="messages" maxOccurs="unbounded"/>
101                                <xs:element name="status" type="status.type" minOccurs="0"/>
102                        </xs:sequence>
103                        <xs:attribute name="ref" use="required"/>
104                        <xs:attribute name="date" type="xs:dateTime"/>
105                        <xs:attribute ref="xml:lang" use="required"/>
106                </xs:complexType>
107        </xs:element>
108       
109        <!-- Groups -->
110        <xs:group name="messages">
111                <xs:choice>
112                        <xs:element name="list" type="list.type"/>
113                        <xs:element name="message" type="message.type"/>
114                        <xs:element name="group" type="group.type"/>
115                </xs:choice>
116        </xs:group>     
117       
118        <xs:group name="description.group">
119                <xs:choice>
120                        <xs:element name="address" type="xhtml.address.type" />
121                        <xs:element name="blockquote" type="xhtml.blockquote.type" />
122                        <xs:element name="pre" type="xhtml.pre.type" />
123                        <xs:element name="h1" type="xhtml.h1.type" />
124                        <xs:element name="h2" type="xhtml.h2.type" />
125                        <xs:element name="h3" type="xhtml.h3.type" />
126                        <xs:element name="h4" type="xhtml.h4.type" />
127                        <xs:element name="h5" type="xhtml.h5.type" />
128                        <xs:element name="h6" type="xhtml.h6.type" />
129                        <xs:element name="div" type="xhtml.div.type" />
130                        <xs:element name="p" type="xhtml.p.type" />
131                        <xs:element name="abbr" type="xhtml.abbr.type" />
132                        <xs:element name="acronym" type="xhtml.acronym.type" />
133                        <xs:element name="cite" type="xhtml.cite.type" />
134                        <xs:element name="code" type="xhtml.code.type" />
135                        <xs:element name="em" type="xhtml.em.type" />
136                        <xs:element name="br" type="xhtml.br.type" />
137                        <xs:element name="span" type="xhtml.span.type" />
138                        <xs:element name="a" type="xhtml.a.type" />
139                        <xs:element name="dt" type="xhtml.dt.type" />
140                        <xs:element name="dl" type="xhtml.dl.type" />
141                        <xs:element name="dd" type="xhtml.dd.type" />
142                        <xs:element name="ol" type="xhtml.ol.type" />
143                        <xs:element name="ul" type="xhtml.ul.type" />
144                        <xs:element name="li" type="xhtml.li.type" />
145                        <xs:element name="img" type="xhtml.img.type" />
146                </xs:choice>
147        </xs:group>
148       
149</xs:schema>
Note: See TracBrowser for help on using the browser.