poikilos

CDI - OpenLCB Standard - July 22, 2024 - Adopted - A Appendix - Schema.xml

Feb 14th, 2025
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.29 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <?xml-stylesheet href="schema2xhtml.xsl" type="text/xsl"?>
  3. <!-- XML Schema for OpenLCB Configuration Description Information (CDI) -->
  4. <xs:schema version="CDI 1.3" xmlns:xs="http://www.w3.org/2001/XMLSchema"
  5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  6.  
  7. <xs:complexType name="mapType">
  8. <xs:annotation>
  9. <xs:documentation>
  10. A map relates one or more property elements (keys)
  11. to specific values.
  12. </xs:documentation>
  13. </xs:annotation>
  14. <xs:sequence>
  15. <xs:element name="name" minOccurs="0" maxOccurs="1" />
  16. <xs:element name="description" minOccurs="0" maxOccurs="1" />
  17. <xs:element name="relation" minOccurs="0" maxOccurs="unbounded">
  18. <xs:complexType>
  19. <xs:sequence>
  20. <xs:element name="property" minOccurs="1" maxOccurs="1" />
  21. <xs:element name="value" minOccurs="1" maxOccurs="1" />
  22. </xs:sequence>
  23. </xs:complexType>
  24. </xs:element>
  25. </xs:sequence>
  26. </xs:complexType>
  27.  
  28. <xs:complexType name="groupType">
  29. <xs:sequence>
  30. <xs:element name="name" minOccurs="0" maxOccurs="1" />
  31. <xs:element name="description" minOccurs="0" maxOccurs="1" />
  32. <xs:element name="repname" minOccurs="0" maxOccurs="unbounded" />
  33. <xs:choice minOccurs="0" maxOccurs="unbounded">
  34. <xs:annotation>
  35. <xs:documentation>
  36. Allows any sequence of the contained element types
  37. </xs:documentation>
  38. </xs:annotation>
  39. <xs:element name="group" type="groupType" minOccurs="0" maxOccurs="1" />
  40. <xs:element name="string" type="stringType" minOccurs="0" maxOccurs="1" />
  41. <xs:element name="int" type="intType" minOccurs="0" maxOccurs="1" />
  42. <xs:element name="eventid" type="eventidType" minOccurs="0" maxOccurs="1" />
  43. <xs:element name="float" type="floatType" minOccurs="0" maxOccurs="1" />
  44. </xs:choice>
  45. </xs:sequence>
  46. <xs:attribute name="offset" type="xs:int" default="0">
  47. <xs:annotation>
  48. <xs:documentation>
  49. Positive or negative offset between the address of
  50. the end of previous element and the start of
  51. this group's contents.
  52. Offset of zero means that this element starts
  53. immediately after the previous one.
  54. </xs:documentation>
  55. </xs:annotation>
  56. </xs:attribute>
  57. <xs:attribute name="replication" type="xs:int" default="1" />
  58. </xs:complexType>
  59.  
  60. <xs:complexType name="eventidType">
  61. <xs:sequence>
  62. <xs:element name="name" minOccurs="0" maxOccurs="1" />
  63. <xs:element name="description" minOccurs="0" maxOccurs="1" />
  64. <xs:element name="map" type="mapType" minOccurs="0" maxOccurs="1" />
  65. </xs:sequence>
  66. <xs:attribute name="offset" type="xs:int" default="0">
  67. <xs:annotation>
  68. <xs:documentation>
  69. Positive or negative offset between the address of
  70. the end of previous element and the start of
  71. this elements's contents.
  72. Offset of zero means that this element starts
  73. immediately after the previous one.
  74. </xs:documentation>
  75. </xs:annotation>
  76. </xs:attribute>
  77. </xs:complexType>
  78.  
  79. <xs:complexType name="intType">
  80. <xs:sequence>
  81. <xs:element name="name" minOccurs="0" maxOccurs="1" />
  82. <xs:element name="description" minOccurs="0" maxOccurs="1" />
  83. <xs:element name="min" minOccurs="0" maxOccurs="1" />
  84. <xs:element name="max" minOccurs="0" maxOccurs="1" />
  85. <xs:element name="default" minOccurs="0" maxOccurs="1" />
  86. <xs:element name="map" type="mapType" minOccurs="0" maxOccurs="1">
  87. <xs:annotation>
  88. <xs:documentation>
  89. The 'value' of each entry is displayed, and
  90. the 'property' content (number) is sent
  91. to/from the node
  92. </xs:documentation>
  93. </xs:annotation>
  94. </xs:element>
  95. </xs:sequence>
  96. <xs:attribute name="size" default="1">
  97. <xs:annotation>
  98. <xs:documentation>
  99. Storage size of this variable in bytes.
  100. </xs:documentation>
  101. </xs:annotation>
  102. <xs:simpleType>
  103. <xs:restriction base="xs:token">
  104. <xs:enumeration value="1"/>
  105. <xs:enumeration value="2"/>
  106. <xs:enumeration value="4"/>
  107. <xs:enumeration value="8"/>
  108. </xs:restriction>
  109. </xs:simpleType>
  110. </xs:attribute>
  111. <xs:attribute name="offset" type="xs:int" default="0">
  112. <xs:annotation>
  113. <xs:documentation>
  114. Positive or negative offset between the
  115. address of the end of previous element and the
  116. start of this elements's contents.
  117. Offset of zero means that this element starts
  118. immediately after the previous one.
  119. </xs:documentation>
  120. </xs:annotation>
  121. </xs:attribute>
  122. </xs:complexType>
  123.  
  124. <xs:simpleType name="floatFormat">
  125. <xs:restriction base="xs:string">
  126. <!-- This is a somewhat limiting regex, as it does not allow all possible -->
  127. <!-- printf formats. It will allow the most common formats that have -->
  128. <!-- been seen and used before, however -->
  129. <xs:pattern value="%[0-9]*(\.([0-9]*))?f"/>
  130. </xs:restriction>
  131. </xs:simpleType>
  132.  
  133. <xs:complexType name="floatType">
  134. <xs:sequence>
  135. <xs:element name="name" minOccurs="0" maxOccurs="1" />
  136. <xs:element name="description" minOccurs="0" maxOccurs="1" />
  137. <xs:element name="min" minOccurs="0" maxOccurs="1" />
  138. <xs:element name="max" minOccurs="0" maxOccurs="1" />
  139. <xs:element name="default" minOccurs="0" maxOccurs="1" />
  140. <xs:element name="map" type="mapType" minOccurs="0" maxOccurs="1">
  141. <xs:annotation>
  142. <xs:documentation>
  143. The 'value' of each entry is displayed, and
  144. the 'property' content (number) is sent
  145. to/from the node
  146. </xs:documentation>
  147. </xs:annotation>
  148. </xs:element>
  149. </xs:sequence>
  150. <xs:attribute name="size" use="required">
  151. <xs:annotation>
  152. <xs:documentation>
  153. Storage size of this variable in bytes.
  154. </xs:documentation>
  155. </xs:annotation>
  156. <xs:simpleType>
  157. <xs:restriction base="xs:token">
  158. <xs:enumeration value="2"/>
  159. <xs:enumeration value="4"/>
  160. <xs:enumeration value="8"/>
  161. </xs:restriction>
  162. </xs:simpleType>
  163. </xs:attribute>
  164. <xs:attribute name="offset" type="xs:int" default="0">
  165. <xs:annotation>
  166. <xs:documentation>
  167. Positive or negative offset between the
  168. address of the end of previous element and the
  169. start of this elements's contents.
  170. Offset of zero means that this element starts
  171. immediately after the previous one.
  172. </xs:documentation>
  173. </xs:annotation>
  174. </xs:attribute>
  175. <xs:attribute name="formatting" type="floatFormat" >
  176. <xs:annotation>
  177. <xs:documentation>
  178. printf-style format string for displaying data to the user, like %3.1f
  179. </xs:documentation>
  180. </xs:annotation>
  181. </xs:attribute>
  182. </xs:complexType>
  183.  
  184. <xs:complexType name="stringType">
  185. <xs:sequence>
  186. <xs:element name="name" minOccurs="0" maxOccurs="1" />
  187. <xs:element name="description" minOccurs="0" maxOccurs="1" />
  188. <xs:element name="map" type="mapType" minOccurs="0" maxOccurs="1" />
  189. </xs:sequence>
  190. <xs:attribute name="size" type="xs:int" use="required">
  191. <xs:annotation>
  192. <xs:documentation>
  193. Storage size of this variable in bytes.
  194. This includes the trailing null byte that
  195. terminates the string content.
  196. </xs:documentation>
  197. </xs:annotation>
  198. </xs:attribute>
  199. <xs:attribute name="offset" type="xs:int" default="0">
  200. <xs:annotation>
  201. <xs:documentation>
  202. Positive or negative offset between the
  203. address of the end of previous element and the
  204. start of this elements's contents.
  205. Offset of zero means that this element starts
  206. immediately after the previous one.
  207. </xs:documentation>
  208. </xs:annotation>
  209. </xs:attribute>
  210. </xs:complexType>
  211.  
  212. <xs:element name="cdi">
  213. <xs:annotation>
  214. <xs:documentation>
  215. This is the schema for Configuration
  216. Description Information (cdi)
  217. </xs:documentation>
  218. </xs:annotation>
  219. <xs:complexType>
  220. <xs:sequence>
  221. <xs:element name="identification" minOccurs="0" maxOccurs="1">
  222. <xs:annotation>
  223. <xs:documentation>
  224. Common first element to identify the decoder
  225. </xs:documentation>
  226. </xs:annotation>
  227. <xs:complexType>
  228. <xs:sequence>
  229. <xs:element name="manufacturer" minOccurs="0" maxOccurs="1" />
  230. <xs:element name="model" minOccurs="0" maxOccurs="1" />
  231. <xs:element name="hardwareVersion" minOccurs="0" maxOccurs="1" />
  232. <xs:element name="softwareVersion" minOccurs="0" maxOccurs="1" />
  233. <xs:element name="map" type="mapType" minOccurs="0" maxOccurs="1">
  234. <xs:annotation>
  235. <xs:documentation>
  236. This map can be used to add arbitrary key/value
  237. descriptions of the node.
  238. </xs:documentation>
  239. </xs:annotation>
  240. </xs:element>
  241. </xs:sequence>
  242. </xs:complexType>
  243. </xs:element>
  244. <xs:element name="acdi" minOccurs="0" maxOccurs="1">
  245. <xs:annotation>
  246. <xs:documentation>
  247. Element that identifies that memory information is available
  248. as defined by the Abbreviated Common Description Information
  249. (ACDI) standard.
  250. </xs:documentation>
  251. </xs:annotation>
  252. <xs:complexType>
  253. <xs:attribute name="fixed" type="xs:int" default="4">
  254. <xs:annotation>
  255. <xs:documentation>
  256. The decimal version number of the format for the fixed
  257. information block.
  258. </xs:documentation>
  259. </xs:annotation>
  260. </xs:attribute>
  261. <xs:attribute name="var" type="xs:int" default="2">
  262. <xs:annotation>
  263. <xs:documentation>
  264. The decimal version number of the format for
  265. the variable information block.
  266. </xs:documentation>
  267. </xs:annotation>
  268. </xs:attribute>
  269. </xs:complexType>
  270. </xs:element>
  271. <xs:element name="segment" minOccurs="0" maxOccurs="unbounded">
  272. <xs:annotation>
  273. <xs:documentation>
  274. Define the contents of a memory space
  275. </xs:documentation>
  276. </xs:annotation>
  277. <xs:complexType>
  278. <xs:sequence>
  279. <xs:element name="name" minOccurs="0" maxOccurs="1" />
  280. <xs:element name="description" minOccurs="0" maxOccurs="1" />
  281. <xs:choice minOccurs="0" maxOccurs="unbounded">
  282. <xs:annotation>
  283. <xs:documentation>
  284. Allows any sequence of the contained element types
  285. </xs:documentation>
  286. </xs:annotation>
  287. <xs:element name="group" type="groupType" minOccurs="0" maxOccurs="1">
  288. <xs:annotation>
  289. <xs:documentation>
  290. Allows grouping and replication of multiple locations.
  291. </xs:documentation>
  292. </xs:annotation>
  293. </xs:element>
  294. <xs:element name="string" type="stringType" minOccurs="0" maxOccurs="1">
  295. <xs:annotation>
  296. <xs:documentation>
  297. Describes a human-readable UTF-8 string in the data.
  298. </xs:documentation>
  299. </xs:annotation>
  300. </xs:element>
  301. <xs:element name="int" type="intType" minOccurs="0" maxOccurs="1">
  302. <xs:annotation>
  303. <xs:documentation>
  304. Describes an integer value in the data.
  305. The field can be considered either a number,
  306. or a set of specific coded values via a map.
  307. </xs:documentation>
  308. </xs:annotation>
  309. </xs:element>
  310. <xs:element name="eventid" type="eventidType" minOccurs="0" maxOccurs="1">
  311. <xs:annotation>
  312. <xs:documentation>
  313. Describes an 8-byte Event ID in the data.
  314. </xs:documentation>
  315. </xs:annotation>
  316. </xs:element>
  317. <!--
  318. XML Schema 1.1 construct expressing extensibility promise
  319. <xs:assert test="every $x in * satisfies (exists($x/@size) and $x/@size castable to
  320. xs:integer)"/>
  321. <xs:assert test="every $x in * satisfies (exists($x/@offset) and $x/@offset castable to
  322. xs:integer)"/>
  323. <xs:any minOccurs="0" maxOccurs="1" processContents="lax">
  324. <xs:annotation>
  325. <xs:documentation>
  326. Extension point for future schema
  327. </xs:documentation>
  328. </xs:annotation>
  329. </xs:any>
  330. -->
  331.  
  332. </xs:choice>
  333. </xs:sequence>
  334. <xs:attribute name="space" type="xs:int" use="required">
  335. <xs:annotation>
  336. <xs:documentation>
  337. The decimal number of the address space where the information is found.
  338. </xs:documentation>
  339. </xs:annotation>
  340. </xs:attribute>
  341. <xs:attribute name="origin" type="xs:int" default="0">
  342. <xs:annotation>
  343. <xs:documentation>
  344. Starting address of the segment's contents
  345. within the memory space.
  346. </xs:documentation>
  347. </xs:annotation>
  348. </xs:attribute>
  349. </xs:complexType>
  350. </xs:element>
  351. </xs:sequence>
  352. </xs:complexType>
  353. </xs:element>
  354. </xs:schema>
Advertisement
Add Comment
Please, Sign In to add comment