source: josm/trunk/data/mappaint-style.xsd@ 7788

Last change on this file since 7788 was 7593, checked in by stoecker, 10 years ago

mapcss has global icon, allow same for XML formats

File size: 4.0 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://josm.openstreetmap.de/mappaint-style-1.0"
3 xmlns:tns="http://josm.openstreetmap.de/mappaint-style-1.0" elementFormDefault="qualified">
4
5 <!--
6 Localized attributes (for example de.description are not supported by
7 xsd, so root element needs <anyAttribute/>
8 -->
9
10 <element name="rules" type="tns:root"/>
11
12 <complexType name="root">
13 <sequence>
14 <choice minOccurs="0" maxOccurs="unbounded">
15 <element name="rule" type="tns:rule" />
16 </choice>
17 </sequence>
18 <attribute name="name" type="string" />
19 <attribute name="author" type="string" />
20 <attribute name="version" type="string" />
21 <attribute name="shortdescription" type="string" />
22 <attribute name="description" type="string" />
23 <attribute name="link" type="string"/>
24 <attribute name="icon" type="string"/>
25
26 <anyAttribute processContents="skip"/>
27 </complexType>
28
29 <!-- TODO: ensure that at least one of results exists, but only one of each element, except for linemod which may have more,
30 scale is totally optional, but each of the two may come only once -->
31 <complexType name="rule">
32 <sequence>
33 <element name="condition" type="tns:condition" minOccurs="1" maxOccurs="unbounded" />
34 <choice minOccurs="1" maxOccurs="unbounded" >
35 <group ref="tns:results" />
36 <group ref="tns:scale" />
37 </choice>
38 </sequence>
39 </complexType>
40
41 <group name="results">
42 <choice>
43 <element name="icon" type="tns:icon" />
44 <element name="area" type="tns:area" />
45 <element name="line" type="tns:line" />
46 <element name="linemod" type="tns:linemod" maxOccurs="unbounded" />
47 </choice>
48 </group>
49
50 <group name="scale">
51 <choice>
52 <element name="scale_min" type="integer" />
53 <element name="scale_max" type="integer" />
54 </choice>
55 </group>
56
57 <complexType name="condition">
58 <!-- TODO restrict to k, k+v or k+b, other attribute combinations are illegal -->
59 <attribute name="k" type="string" use="required" />
60 <attribute name="v" type="string" />
61 <attribute name="b" type="tns:yesno" />
62 </complexType>
63
64 <complexType name="icon">
65 <attribute name="src" type="string" use="required" />
66 <attribute name="annotate" type="boolean" />
67 <attribute name="priority" type="integer" />
68 </complexType>
69
70 <complexType name="line">
71 <attribute name="width" type="integer" />
72 <attribute name="dashed" type="tns:dashed" />
73 <attribute name="realwidth" type="integer" />
74 <attribute name="colour" type="tns:color" />
75 <attribute name="dashedcolour" type="tns:color" />
76 <attribute name="priority" type="integer" />
77 </complexType>
78
79 <complexType name="area">
80 <attribute name="colour" type="tns:color" />
81 <attribute name="closed" type="boolean" />
82 <attribute name="priority" type="integer" />
83 </complexType>
84
85 <complexType name="linemod">
86 <attribute name="dashed" type="tns:dashed" />
87 <attribute name="realwidth" type="integer" />
88 <attribute name="colour" type="tns:color" />
89 <attribute name="dashedcolour" type="tns:color" />
90 <attribute name="mode" type="tns:modifier_mode" use="required" />
91 <attribute name="width" type="tns:width" />
92 </complexType>
93
94 <simpleType name="yesno">
95 <restriction base="string">
96 <enumeration value="yes"/>
97 <enumeration value="no"/>
98 </restriction>
99 </simpleType>
100
101 <simpleType name="dashed">
102 <restriction base="string">
103 <pattern value="\d+(,\d+)*"/>
104 <pattern value="(true|false)"/>
105 </restriction>
106 </simpleType>
107
108 <simpleType name="modifier_mode">
109 <restriction base="string">
110 <enumeration value="under"/>
111 <enumeration value="over"/>
112 </restriction>
113 </simpleType>
114
115 <simpleType name="color">
116 <restriction base="string">
117 <pattern value="([a-z0-9_]+#)?[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?"/>
118 <!-- name#color or color only, where color is 6 or 8 hex digits -->
119 </restriction>
120 </simpleType>
121
122 <simpleType name="width">
123 <restriction base="string">
124 <pattern value="\d+"/>
125 <pattern value="[+-]\d+"/>
126 <pattern value="\d+%"/>
127 </restriction>
128 </simpleType>
129</schema>
Note: See TracBrowser for help on using the repository browser.