Project

General

Profile

Bug #44 » chirp_memory.xsd

Updated schema - Mark Whitis, 01/07/2012 09:45 PM

 
1
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2

    
3
  <xsd:complexType name="memoryType">
4
    <xsd:sequence>
5
      <xsd:element name="shortName" type="shortNameType"/>
6
      <xsd:element name="longName" type="longNameType" minOccurs="0"/>
7
      <xsd:element name="frequency" type="frequencyType"/>
8
      <xsd:element name="squelch" type="squelchType"
9
		   minOccurs="0" maxOccurs="3"/>
10
      <xsd:element name="squelchSetting" type="xsd:string" minOccurs="0"/>
11
      <xsd:element name="duplex" type="duplexType"/>
12
      <xsd:element name="offset" type="frequencyType"/>
13
      <xsd:element name="mode" type="modeType"/>
14
      <xsd:element name="tuningStep" type="frequencyType"/>
15
      <xsd:element name="skip" type="skipType" minOccurs="0" maxOccurs="1"/>
16
      <xsd:element name="bank" type="bankInfoType" minOccurs="0" maxOccurs="1"/>
17
      <xsd:element name="dv" type="dvType" minOccurs="0"/>
18
      <xsd:element name="stationInfo" type="stationInfoType" minOccurs="0" maxOccurs="1"/>
19

    
20
    </xsd:sequence>
21
    <xsd:attribute name="location" type="xsd:nonNegativeInteger"/>
22
  </xsd:complexType>
23

    
24
  <xsd:simpleType name="shortNameType">
25
    <xsd:restriction base="xsd:string">
26
      <xsd:pattern value="[A-Z0-9/ >-]{0,6}"/>
27
    </xsd:restriction>
28
  </xsd:simpleType>
29

    
30
  <xsd:complexType name="frequencyType">
31
    <xsd:simpleContent>
32
      <xsd:extension base="xsd:decimal">
33
	<xsd:attribute name="units" type="freqUnitsType" use="required"/>
34
      </xsd:extension>
35
    </xsd:simpleContent>
36
  </xsd:complexType>
37
  
38
  <xsd:simpleType name="freqUnitsType">
39
    <xsd:restriction base="xsd:string">
40
      <xsd:enumeration value="Hz"/>
41
      <xsd:enumeration value="kHz"/>
42
      <xsd:enumeration value="MHz"/>
43
      <xsd:enumeration value="GHz"/>
44
    </xsd:restriction>
45
  </xsd:simpleType>
46

    
47
  <xsd:simpleType name="longNameType">
48
    <xsd:restriction base="xsd:string">
49
      <xsd:pattern value="[.A-Za-z0-9/ >-]{0,16}"/>
50
    </xsd:restriction>
51
  </xsd:simpleType>
52

    
53

    
54
  <xsd:complexType name="squelchType">
55
    <xsd:sequence>
56
      <xsd:element name="tone" type="xsd:decimal" minOccurs="0"/>
57
      <xsd:element name="code" type="xsd:positiveInteger" minOccurs="0"/>
58
      <xsd:element name="polarity" type="dtcsPolarityType" minOccurs="0"/>
59
    </xsd:sequence>
60
    <xsd:attribute name="id"/>
61
    <xsd:attribute name="type"/>
62
  </xsd:complexType>
63

    
64
  <xsd:simpleType name="dtcsPolarityType">
65
    <xsd:restriction base="xsd:string">
66
      <xsd:pattern value="[RN]{2}"/>
67
    </xsd:restriction>
68
  </xsd:simpleType>
69

    
70
  <xsd:simpleType name="duplexType">
71
    <xsd:restriction base="xsd:string">
72
      <xsd:enumeration value="positive"/>
73
      <xsd:enumeration value="negative"/>
74
      <xsd:enumeration value="none"/>
75
    </xsd:restriction>
76
  </xsd:simpleType>
77

    
78
  <xsd:simpleType name="modeType">
79
    <xsd:restriction base="xsd:string">
80
      <xsd:enumeration value="FM"/>
81
      <xsd:enumeration value="NFM"/>
82
      <xsd:enumeration value="WFM"/>
83
      <xsd:enumeration value="AM"/>
84
      <xsd:enumeration value="NAM"/>
85
      <xsd:enumeration value="DV"/>
86
    </xsd:restriction>
87
  </xsd:simpleType>
88

    
89
  <xsd:complexType name="dvType">
90
    <xsd:sequence>
91
      <xsd:element name="urcall" type="callsignType"/>
92
      <xsd:element name="rpt1call" type="callsignType"/>
93
      <xsd:element name="rpt2call" type="callsignType"/>
94
      <xsd:element name="digitalCode" type="digitalCodeType" minOccurs="0"/>
95
    </xsd:sequence>
96
  </xsd:complexType>
97

    
98
  <!-- Info on repeater, digipeater, satellite, beacon, broadcast, or other station used on this channel -->
99
  <!-- These fields allow repeater directories to be published in a format which can be readily imported into chirp for programming radios, or converted to GPX, KML, google earth, google maps, gpsbabel, HTML, etc.  Or to use next generation radios which can automatically select repeaters based on your location or display maps of repeaters -->
100

    
101
  <xsd:complexType name="stationInfoType">
102
    <xsd:sequence>
103
       <xsd:element name="coordinates" type="coordinatesType"  minOccurs="0" maxOccurs="1"/>
104

    
105
       <xsd:element name="callsign" type="callsignType" minOccurs="0" maxOccurs="1"/>
106
       <xsd:element name="Website" type="xsd:string" minOccurs="0" maxOccurs="1"/> 
107
           <!-- could be xsd:anyURI but handlers for this may not exist elsewhere in program -->
108
       <xsd:element name="antennaLocation" type="xsd:string" minOccurs="0" maxOccurs="1"/> 
109
          <!-- example "Afton Mountain" -->
110
       <xsd:element name="city" type="xsd:string" minOccurs="0" maxOccurs="1"/>           <!-- nearest city, example "Afton" or "Charlottesville" -->
111
       <xsd:element name="state" type="xsd:string" minOccurs="0" maxOccurs="1"/>           <!-- example "VA" --> 
112
       <csd:element name="postalCode" type "xsd:string" minOccurs="0" maxOccurs="1"/>
113
       <xsd:element name="country" type="xsd:string" minOccurs="0" maxOccurs="1"/>           <!-- example "US", ISO 2-letter code  --> 
114
       <xsd:element name="Sponsor" type="xsd:string" minOccurs="0" maxOccurs="1"/>
115
          <!-- Organization or person responsible for maintaining this station/owner.   Example AARC, AMSAT, etc. -->
116
  
117
       <xsd:element name="Comment" type="xsd:string" minOccurs="0" maxOccurs="1"/>
118
       <xsd:element name="StationWatts" type="xsd:decimal" minOccurs="0" maxOccurs="1"/>
119
       <xsd:element name="access" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- "open"/"closed" -->
120
       <xsd:element name="modulation" type="xsd:string" minOccurs="0" maxOccurs="1"/>
121
    <!-- FM, NarrowFM, AM, SSB, packet, CW, PSK31, APRS, D-Star, Pactor, etc. --> 
122
       <xsd:element name="antenna" type="xsd:string" minOccurs="0" maxOccurs="1"/>
123
       <xsd:element name="irlpNode" type="xsd:string" minOccurs="0" maxOccurs="1"/>       
124
       <xsd:element name="echoNode" type="xsd:string" minOccurs="0" maxOccurs="1"/>  <!-- echolink node -->
125
       <xsd:element name="echoLinkNode" type="xsd:string" minOccurs="0" maxOccurs="1"/>  <!-- echolink node -->
126
       <xsd:element name="eQSONode" type="xsd:string" minOccurs="0" maxOccurs="1"/>  <!-- echolink node -->
127

    
128
       <xsd:element name="Autopatch" type "xsd:string" minOccurs="0" maxOccurs="1"/>
129

    
130

    
131
    <xsd:sequence>
132
  </xsd:complexType>
133

    
134
  <xsd:complexType name="coordinatesType">
135
     <xsd:sequence>
136
       <xsd:element name="latitude" type="xsd:decimal" minOccurs="0" maxOccurs="1"/>
137
       <xsd:element name="longitude" type="xsd:decimal" minOccurs="0" maxOccurs="1"/>
138
       <xsd:element  name="altitude" type="xsd:decimal" minOccurs="0" maxOccurs="1"/> <!-- antenna height  -->
139
       <xsd:element name="altitudeMode" type="xsd:string"  minOccurs="0" maxOccurs="1"/>
140
          <!-- "relativeToGround" or "absolute" http://code.google.com/apis/kml/documentation/kmlreference.html#point -->
141
       <xsd:element name="uncertainty" type="xsd:string" minOccurs="0" maxOccurs="1"/> <!-- uncertainty in lat/long/altitude. Example: "10meters" or "unknown". Did you measure it with an accurate GPS or did you estimate based on the generic location of Afton Mountain on a map or a city center?  -->
142
       <xsd:element name="datum" type="xsd:string" minOccurs="0" maxOccurs="1"/>
143
     </xsd:sequence>
144
  </xsd:complexType>
145

    
146

    
147
  <xsd:simpleType name="callsignType">
148
    <xsd:restriction base="xsd:string">
149
      <xsd:pattern value="[A-Z0-9/ ]*"/>
150
    </xsd:restriction>
151
  </xsd:simpleType>
152

    
153
  <xsd:simpleType name="digitalCodeType">
154
    <xsd:restriction base="xsd:integer">
155
      <xsd:minInclusive value="0"/>
156
    </xsd:restriction>
157
  </xsd:simpleType>
158

    
159
  <xsd:simpleType name="skipType">
160
    <xsd:restriction base="xsd:string">
161
      <xsd:enumeration value="S"/>
162
      <xsd:enumeration value="P"/>
163
      <xsd:enumeration value=""/>
164
    </xsd:restriction>
165
  </xsd:simpleType>
166

    
167
  <xsd:complexType name="bankInfoType">
168
    <xsd:attribute name="bankId" type="xsd:nonNegativeInteger" use="required"/>
169
    <xsd:attribute name="bankIndex" type="xsd:nonNegativeInteger"/>
170
  </xsd:complexType>
171
  
172
</xsd:schema>
173

    
174
  <!-- Comments by AK4OL:
175
In order to minimize exciting bugs in existing software, simple, already used, types such as xsd:decimal and xsd:string were used for most of the added fields.   Existing code may not know how to handle xsd:all, xsd:anyURI, xsd:annotation/xsd:documentation etc.)
176

    
177
All occurances of xsd:sequence in this file should really be xsd:all.  The program has no business enforcing a specific order.  Interoperability dictates that you generate fields in the order listed but take them in any order; i.e. demand more of yourself than you demand of others.  Strictly validate your output, not your input.  Fools often get this backwards and destroy one of the primary advantages of XML).  Interoperability also dictates that you do not choke on unrecognized fields as the program currently does; this means, for example, that version 1.0 will choke on version 2.0 files or files generated by other programs which use the same format but add extensions.   This makes chirp files almost useless for information interchange between users or even between different machines used by the same user which may have different versions.  Warn that there is unrecognized data but parse all the data you can.   validate_doc() must be disabled or modified to produce warnings only.  It is ok to require the file to be well formed xml but it is not ok to fail if their are unrecognized fields or the field order is different.
178

    
179
Chirp currently generates attrociously formatted XML - all on one line.   Chirp can read properly formatted xml.
180
sudo apt-get install libxml-tidy-perl
181
xmltidy somefile.chirp   # warning: modifies in place
182

    
183
  Chirp already has the ability to hide fields which are not of interest.  In addition, these additional fields will not be displayed if you are editing a radio file, just a chirp file.
184

    
185
   location attribute on memoryType should be optional.   If data has been imported, it may be meaningless or absent.
186

    
187
In xml.py
188
      rf.memory_bounds = (0, 1000)
189
is probably a bug.   Some radios have more than 1000 memories.
190

    
191
    <memory location="17">
192
      <shortName>WA4TFZ</shortName>
193
      <longName>WA4TFZ</longName>
194
      <frequency units="MHz">146.895000</frequency>
195
      <squelch id="rtone" type="repeater">
196
        <tone>151.4</tone>
197
      </squelch>
198
      <squelch id="ctone" type="ctcss">
199
        <tone>88.5</tone>
200
      </squelch>
201
      <squelch id="dtcs" type="dtcs">
202
        <code>023</code>
203
        <polarity>NN</polarity>
204
      </squelch>
205
      <squelchSetting>rtone</squelchSetting>
206
      <duplex>negative</duplex>
207
      <offset units="MHz">0.600000</offset>
208
      <mode>FM</mode>
209
      <tuningStep units="kHz">5.00000</tuningStep>
210

    
211
      <stationInfo>
212
	<coordinates>
213
	   <latitude>38.105092</latitude>
214
	   <longitude>-78.744168</longitude>
215
	   <altitude>964m</altitude>
216
	   <uncertainty>1km</uncertainty>
217
	</coordinates>
218
	<callsign>WA4TFZ</callsign>
219
	<website>http://www.albemarleradio.org/node/10</website>
220
	<antennaLocation>Bucks Elbow Mtn</antennaLocation>
221
	<city>Charlottesville</city>
222
	<state>VA</state>
223
	<postalCode>22932</postalCode>
224
	<country>US</country>
225
	<Sponsor>Albemarle Amateur Radio Club</Sponsor>
226
	<Comment>coordinates approximated from google earth between visable antennas on summit; however, newsletter suggests that repeater was moved down from the summit, probably due to national radio quiet zone restrictions.  Vertex repeater hardware</Comment>
227
	<StationWatts></StationWatts>
228
	<modulation>FM</modulation>
229
	<antenna>2m/440 dual band</antenna>
230
	<irlpNode></irlpNode>
231
	<echoLinkNode></echoLinkNode>
232
        <eQSONode></eQSONode>
233
        <autopatch></autopatch>
234
      </stationInfo>
235

    
236
  </memory>
237

    
238
-->
(2-2/3)