From aee84e8b377a13e9d6e19ff3c242dab8b748ff8d Mon Sep 17 00:00:00 2001
From: Martin Killenberg <martin.killenberg@desy.de>
Date: Wed, 2 Aug 2017 17:31:26 +0200
Subject: [PATCH] first variable tree xml that validates against a schema. Not
 really useful yet.

---
 tests/variableTreeXml/simpleTree.xml | 13 +++++++
 xmlschema/doocs_variable_tree.xsd    | 57 ++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
 create mode 100644 tests/variableTreeXml/simpleTree.xml
 create mode 100644 xmlschema/doocs_variable_tree.xsd

diff --git a/tests/variableTreeXml/simpleTree.xml b/tests/variableTreeXml/simpleTree.xml
new file mode 100644
index 0000000..28bc38a
--- /dev/null
+++ b/tests/variableTreeXml/simpleTree.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<doocs_variable_tree xmlns="https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter doocs_variable_tree.xsd">
+  <facility>
+    <device>
+      <location>
+        <property source="A/b/cd/e">
+          <has_history/>
+          <is_constant/>
+        </property>
+      </location>
+    </device>
+  </facility>
+</doocs_variable_tree>
diff --git a/xmlschema/doocs_variable_tree.xsd b/xmlschema/doocs_variable_tree.xsd
new file mode 100644
index 0000000..5531530
--- /dev/null
+++ b/xmlschema/doocs_variable_tree.xsd
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter"
+            xmlns="https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter"
+            elementFormDefault="qualified"
+            attributeFormDefault="unqualified">
+
+  <xs:annotation>
+    <xs:documentation xml:lang="en">
+     Variable tree definition for the ChimeraTK DOOCS Adapter.
+     NOTE: This is a first draft version! Do not use for production!
+    </xs:documentation>
+  </xs:annotation>
+
+  <xs:element name="doocs_variable_tree" type="DoocsTreeType"/>
+
+  <xs:complexType name="DoocsTreeType">
+    <xs:sequence>
+      <xs:element name="facility" type="FacilityType" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="FacilityType">
+    <xs:sequence>
+      <xs:element name="device" type="DeviceType" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="DeviceType">
+    <xs:sequence>
+      <xs:element name="location" type="LocationType" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="LocationType">
+    <xs:sequence>
+      <xs:element name="property" type="PropertyType" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="PropertyType">
+    <xs:sequence>
+      <xs:element name="has_history" type="xs:boolean" default="true"/>
+      <xs:element name="is_constant" type="xs:boolean" default="false"/>
+      <xs:element name="spectrum" type="SpectrumType" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="source" type="xs:string" use="required"/>
+    <xs:attribute name="name" type="xs:string"/>
+  </xs:complexType>
+
+ 
+   <xs:complexType name="SpectrumType">
+     <xs:attribute name="start" type="xs:float" default="0.0"/>
+     <xs:attribute name="increment" type="xs:float" default="1.0"/>
+  </xs:complexType>
+
+ </xs:schema>
-- 
GitLab