From c1a9f54fea55322638899774f765b8563c9038e9 Mon Sep 17 00:00:00 2001
From: ankraft <an.kraft@googlemail.com>
Date: Mon, 7 Sep 2015 15:30:58 +0200
Subject: [PATCH] Fixed optionals in XSD. Fixed various examples.

---
 SDT/schema3.0/etc/domain.rnc    |  56 +++++++++----
 SDT/schema3.0/src/domain.rng    | 142 +++++++++++++++++++++-----------
 SDT/schema3.0/src/domain.xsd    | 100 +++++++++++++++-------
 SDT/schema3.0/test/dal-core.xml |  52 ++++++------
 SDT/schema3.0/test/dal-eg.xml   |  25 +++---
 SDT/schema3.0/test/mseeb.xml    |  51 ++++++++----
 6 files changed, 275 insertions(+), 151 deletions(-)

diff --git a/SDT/schema3.0/etc/domain.rnc b/SDT/schema3.0/etc/domain.rnc
index 05ed3f1..0fadcc4 100644
--- a/SDT/schema3.0/etc/domain.rnc
+++ b/SDT/schema3.0/etc/domain.rnc
@@ -1,5 +1,4 @@
 start = Domain
-
 Domain =
   element Domain {
     # still having some problems with included documents ... 
@@ -13,27 +12,28 @@ Domain =
     # </attribute>
     attribute xml:base { xsd:anyURI }?,
     attribute id { xsd:ID },
-    Imports,
+    Doc,
+    element Imports { Domain* }?,
     element Modules {
       element ModuleClass { ModuleDef }*
     }?,
     element Devices {
       element Device {
         attribute id { xsd:Name },
-        DeviceInfo,
         Doc,
+        DeviceInfo,
         Modules?,
         element SubDevices {
-          element SubDevice { DeviceDef }*
+          element SubDevice {
+            attribute id { xsd:Name },
+            Doc,
+            DeviceInfo,
+            Modules?
+          }*
         }?
       }*
     }?
   }
-DeviceDef =
-  attribute id { xsd:Name },
-  DeviceInfo,
-  Doc,
-  Modules?
 DeviceInfo =
   element DeviceInfo {
     element Name { text }
@@ -42,7 +42,29 @@ DeviceInfo =
     & element SerialNumber { text }?
     & element VendorURL { xsd:anyURI }?
   }
-DataType =
+DataTypeElement = element DataType { DataTypeDef }
+DataTypeDef =
+  # Discuss: Doc on DataType?
+  attribute unitOfMeasure { text }?,
+  (StructType | ArrayType | SimpleType)
+StructType =
+  element Struct {
+    attribute name { text }?,
+    DataTypeDef+
+  }
+ArrayType =
+  element Array {
+    attribute name { text }?,
+    DataTypeDef
+  }
+SimpleType =
+  element SimpleType {
+    attribute name { text }?,
+    attribute type { BasicType }
+    # TODO Constraints
+    
+  }
+BasicType =
   "integer"
   | "boolean"
   | "string"
@@ -88,13 +110,13 @@ Actions =
   element Actions {
     element Action {
       attribute name { text },
-      attribute type { DataType }?,
       attribute optional { xsd:boolean }?,
       Doc,
+      DataTypeDef?,
       element Arg {
         attribute name { text },
-        attribute type { DataType },
-        Doc
+        Doc,
+        DataTypeDef
       }*
     }*
   }
@@ -103,11 +125,11 @@ Data =
     element DataPoint {
       attribute name { text },
       attribute optional { xsd:boolean }?,
-      attribute type { DataType },
       attribute writable { xsd:boolean }?,
       attribute readable { xsd:boolean }?,
       attribute eventable { xsd:boolean }?,
-      Doc
+      Doc,
+      DataTypeDef
     }*
   }
 Events =
@@ -115,7 +137,7 @@ Events =
     element Event {
       attribute name { text },
       attribute optional { xsd:boolean }?,
-      Data,
-      Doc
+      Doc,
+      Data
     }*
   }
diff --git a/SDT/schema3.0/src/domain.rng b/SDT/schema3.0/src/domain.rng
index d6b2986..eda9e69 100644
--- a/SDT/schema3.0/src/domain.rng
+++ b/SDT/schema3.0/src/domain.rng
@@ -6,16 +6,6 @@
 		<ref name="Domain"/>
 	</start>
 
-	<define name="Imports">
-		<optional>
-			<element name="Imports">
-				<zeroOrMore>
-					<ref name="Domain"/>
-				</zeroOrMore>
-			</element>
-		</optional>
-	</define>
-
 	<define name="Domain">
 		<element name="Domain">
 			<optional>
@@ -38,7 +28,14 @@
 			<attribute name="id">
 				<data type="ID"/>
 			</attribute>
-			<ref name="Imports"/>
+			<ref name="Doc"/>
+			<optional>
+				<element name="Imports">
+					<zeroOrMore>
+						<ref name="Domain"/>
+					</zeroOrMore>
+				</element>
+			</optional>
 			<optional>
 				<element name="Modules">
 					<zeroOrMore>
@@ -55,20 +52,27 @@
 							<attribute name="id">
 								<data type="Name"/>
 							</attribute>
-							<ref name="DeviceInfo"/>
 							<ref name="Doc"/>
+							<ref name="DeviceInfo"/>
 							<optional>
 								<ref name="Modules"/>
 							</optional>
-						<optional>
-							<element name="SubDevices">
-								<zeroOrMore>
-									<element name="SubDevice">
-										<ref name="DeviceDef"/>
-									</element>
-								</zeroOrMore>
-							</element>
-						</optional>
+							<optional>
+								<element name="SubDevices">
+									<zeroOrMore>
+										<element name="SubDevice">
+											<attribute name="id">
+												<data type="Name"/>
+											</attribute>
+											<ref name="Doc"/>
+											<ref name="DeviceInfo"/>
+											<optional>
+												<ref name="Modules"/>
+											</optional>
+										</element>
+									</zeroOrMore>
+								</element>
+							</optional>
 						</element>
 					</zeroOrMore>
 				</element>
@@ -76,17 +80,6 @@
 		</element>
 	</define>
 
-	<define name="DeviceDef">
-		<attribute name="id">
-			<data type="Name"/>
-		</attribute>
-		<ref name="DeviceInfo"/>
-		<ref name="Doc"/>
-		<optional>
-			<ref name="Modules"/>
-		</optional>
-	</define>
-
 
 	<define name="DeviceInfo">
 		<element name="DeviceInfo">
@@ -117,7 +110,70 @@
 	</define>
 
 
-	<define name="DataType">
+	<define name="DataTypeElement">
+		<element name="DataType">
+			<ref name="DataTypeDef" />
+		</element>
+	</define>
+
+
+	<define name="DataTypeDef">
+		<!-- Discuss: Doc on DataType? -->
+		<optional>
+			<attribute name="unitOfMeasure">
+				<text/>
+			</attribute>
+		</optional>
+		<choice>
+			<ref name="StructType" />
+			<ref name="ArrayType" />
+			<ref name="SimpleType" />
+		</choice>
+	</define>
+
+
+	<define name="StructType">
+		<element name="Struct">
+			<optional>
+				<attribute name="name">
+					<text/>
+				</attribute>
+			</optional>
+			<oneOrMore>
+				<ref name="DataTypeDef" />
+			</oneOrMore>
+		</element>
+	</define>
+
+
+	<define name="ArrayType">
+		<element name="Array">
+			<optional>
+				<attribute name="name">
+					<text/>
+				</attribute>
+			</optional>
+			<ref name="DataTypeDef" />
+		</element>
+	</define>
+
+
+	<define name="SimpleType">
+		<element name="SimpleType">
+			<optional>
+				<attribute name="name">
+					<text/>
+				</attribute>
+			</optional>
+			<attribute name="type">
+				<ref name="BasicType" />
+			</attribute>
+			<!-- TODO Constraints -->
+		</element>
+	</define>
+
+
+	<define name="BasicType">
 		<choice>
 			<value>integer</value>
 			<value>boolean</value>
@@ -134,6 +190,7 @@
 		</choice>
 	</define>
 
+
 	<define name="DocText">
 		<zeroOrMore>
 			<choice>
@@ -224,24 +281,20 @@
 					<attribute name="name">
 						<text/>
 					</attribute>
-					<optional>
-						<attribute name="type">
-							<ref name="DataType"/>
-						</attribute>
-					</optional>
 					<optional>
 						<attribute name="optional">
 							<data type="boolean"/>
 						</attribute>
 					</optional>
 					<ref name="Doc"/>
+					<optional>
+						<ref name="DataTypeDef"/>
+					</optional>
 					<zeroOrMore>
 						<element name="Arg">
 							<attribute name="name"/>
-							<attribute name="type">
-								<ref name="DataType"/>
-							</attribute>
 							<ref name="Doc"/>
+							<ref name="DataTypeDef"/>
 						</element>
 					</zeroOrMore>
 				</element>
@@ -262,9 +315,6 @@
 							<data type="boolean"/>
 						</attribute>
 					</optional>
-					<attribute name="type">
-						<ref name="DataType"/>
-					</attribute>
 					<optional>
 						<attribute name="writable">
 							<data type="boolean"/>
@@ -281,6 +331,7 @@
 						</attribute>
 					</optional>
 					<ref name="Doc"/>
+					<ref name="DataTypeDef"/>
 				</element>
 			</zeroOrMore>
 		</element>
@@ -299,13 +350,12 @@
 							<data type="boolean"/>
 						</attribute>
 					</optional>
-					<ref name="Data" />
 					<ref name="Doc"/>
+					<ref name="Data" />
 				</element>
 			</zeroOrMore>
 		</element>
 	</define>
 
-
 </grammar>
 
diff --git a/SDT/schema3.0/src/domain.xsd b/SDT/schema3.0/src/domain.xsd
index 343e5e8..0ae52c1 100644
--- a/SDT/schema3.0/src/domain.xsd
+++ b/SDT/schema3.0/src/domain.xsd
@@ -5,22 +5,11 @@
 	  
  elementFormDefault="qualified">
   <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
-  <xs:group name="Imports">
-    <xs:sequence>
-      <xs:element minOccurs="0" ref="Imports"/>
-    </xs:sequence>
-  </xs:group>
-  <xs:element name="Imports">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element minOccurs="0" maxOccurs="unbounded" ref="Domain"/>
-      </xs:sequence>
-    </xs:complexType>
-  </xs:element>
   <xs:element name="Domain">
     <xs:complexType>
       <xs:sequence>
-        <xs:group ref="Imports"/>
+        <xs:group ref="Doc"/>
+        <xs:element minOccurs="0" ref="Imports"/>
         <xs:element minOccurs="0" name="Modules">
           <xs:complexType>
             <xs:sequence>
@@ -34,6 +23,13 @@
       <xs:attribute name="id" use="required" type="xs:ID"/>
     </xs:complexType>
   </xs:element>
+  <xs:element name="Imports">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element minOccurs="0" maxOccurs="unbounded" ref="Domain"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
   <xs:element name="ModuleClass" type="ModuleDef"/>
   <xs:element name="Devices">
     <xs:complexType>
@@ -45,8 +41,8 @@
   <xs:element name="Device">
     <xs:complexType>
       <xs:sequence>
-        <xs:element ref="DeviceInfo"/>
         <xs:group ref="Doc"/>
+        <xs:element ref="DeviceInfo"/>
         <xs:element minOccurs="0" ref="Modules"/>
         <xs:element minOccurs="0" ref="SubDevices"/>
       </xs:sequence>
@@ -60,15 +56,16 @@
       </xs:sequence>
     </xs:complexType>
   </xs:element>
-  <xs:element name="SubDevice" type="DeviceDef"/>
-  <xs:complexType name="DeviceDef">
-    <xs:sequence>
-      <xs:element ref="DeviceInfo"/>
-      <xs:group ref="Doc"/>
-      <xs:element minOccurs="0" ref="Modules"/>
-    </xs:sequence>
-    <xs:attribute name="id" use="required" type="xs:Name"/>
-  </xs:complexType>
+  <xs:element name="SubDevice">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:group ref="Doc"/>
+        <xs:element ref="DeviceInfo"/>
+        <xs:element minOccurs="0" ref="Modules"/>
+      </xs:sequence>
+      <xs:attribute name="id" use="required" type="xs:Name"/>
+    </xs:complexType>
+  </xs:element>
   <xs:element name="DeviceInfo">
     <xs:complexType>
       <xs:all>
@@ -85,7 +82,43 @@
   <xs:element name="FirmwareVersion" type="xs:string"/>
   <xs:element name="SerialNumber" type="xs:string"/>
   <xs:element name="VendorURL" type="xs:anyURI"/>
-  <xs:simpleType name="DataType">
+  <xs:element name="DataType">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="DataTypeDef"/>
+      </xs:sequence>
+      <xs:attributeGroup ref="DataTypeDef"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="DataTypeDef" abstract="true"/>
+  <xs:attributeGroup name="DataTypeDef">
+    <xs:attribute name="unitOfMeasure"/>
+  </xs:attributeGroup>
+  <xs:element name="Struct" substitutionGroup="DataTypeDef">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="DataTypeDef"/>
+      </xs:sequence>
+      <xs:attribute name="name"/>
+      <xs:attributeGroup ref="DataTypeDef"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="Array" substitutionGroup="DataTypeDef">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="DataTypeDef"/>
+      </xs:sequence>
+      <xs:attribute name="name"/>
+      <xs:attributeGroup ref="DataTypeDef"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="SimpleType" substitutionGroup="DataTypeDef">
+    <xs:complexType>
+      <xs:attribute name="name"/>
+      <xs:attribute name="type" use="required" type="BasicType"/>
+    </xs:complexType>
+  </xs:element>
+  <xs:simpleType name="BasicType">
     <xs:restriction base="xs:token">
       <xs:enumeration value="integer"/>
       <xs:enumeration value="boolean"/>
@@ -179,18 +212,22 @@
     <xs:complexType>
       <xs:sequence>
         <xs:group ref="Doc"/>
+        <xs:element minOccurs="0" ref="DataTypeDef"/>
         <xs:element minOccurs="0" maxOccurs="unbounded" ref="Arg"/>
       </xs:sequence>
       <xs:attribute name="name" use="required"/>
-      <xs:attribute name="type" type="DataType"/>
       <xs:attribute name="optional" type="xs:boolean"/>
+      <xs:attributeGroup ref="DataTypeDef"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="Arg">
     <xs:complexType>
-      <xs:group ref="Doc"/>
+      <xs:sequence>
+        <xs:group ref="Doc"/>
+        <xs:element ref="DataTypeDef"/>
+      </xs:sequence>
       <xs:attribute name="name" use="required"/>
-      <xs:attribute name="type" use="required" type="DataType"/>
+      <xs:attributeGroup ref="DataTypeDef"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="Data">
@@ -202,13 +239,16 @@
   </xs:element>
   <xs:element name="DataPoint">
     <xs:complexType>
-      <xs:group ref="Doc"/>
+      <xs:sequence>
+        <xs:group ref="Doc"/>
+        <xs:element ref="DataTypeDef"/>
+      </xs:sequence>
       <xs:attribute name="name" use="required"/>
       <xs:attribute name="optional" type="xs:boolean"/>
-      <xs:attribute name="type" use="required" type="DataType"/>
       <xs:attribute name="writable" type="xs:boolean"/>
       <xs:attribute name="readable" type="xs:boolean"/>
       <xs:attribute name="eventable" type="xs:boolean"/>
+      <xs:attributeGroup ref="DataTypeDef"/>
     </xs:complexType>
   </xs:element>
   <xs:element name="Events">
@@ -221,8 +261,8 @@
   <xs:element name="Event">
     <xs:complexType>
       <xs:sequence>
-        <xs:element ref="Data"/>
         <xs:group ref="Doc"/>
+        <xs:element ref="Data"/>
       </xs:sequence>
       <xs:attribute name="name" use="required"/>
       <xs:attribute name="optional" type="xs:boolean"/>
diff --git a/SDT/schema3.0/test/dal-core.xml b/SDT/schema3.0/test/dal-core.xml
index f877f3e..513013f 100644
--- a/SDT/schema3.0/test/dal-core.xml
+++ b/SDT/schema3.0/test/dal-core.xml
@@ -3,33 +3,29 @@
 <Domain xmlns="http://homegatewayinitiative.org/xml/dal/3.0" 
 	id="hgi.dal.core">
 
-  <Modules>
-    <ModuleClass name="BooleanState">
-      <Doc>
-	<tt>BooleanState</tt> is the preferred module for modelling a
-	functionality corresponding to an underlying binary state. This
-	module should be used to abstract away from the actual datatype
-	and values in question. Note that the module does not define whether
-	the execution mode is blocking or non-blocking.
-      </Doc>
-      <Actions>
-	<Action name="get" type="boolean">
-	  <Doc>
-	    Obtain the current associated state.
-	  </Doc>
-	</Action>
-	<Action name="setTarget">
-	  <Doc>
-	    Set the associated state to the specified value.
-	  </Doc>
-	  <Arg name="value" type="boolean">
-	    <Doc>
-	      The desired value of the associated state.
-	    </Doc>
-	  </Arg>
-	</Action>
-      </Actions>
-    </ModuleClass>
-  </Modules>
+	<Modules>
+		<ModuleClass name="BooleanState">
+			<Doc>
+				<tt>BooleanState</tt> is the preferred module for modelling a
+				functionality corresponding to an underlying binary state. This
+				module should be used to abstract away from the actual datatype
+				and values in question. Note that the module does not define whether
+				the execution mode is blocking or non-blocking.
+				</Doc>
+			<Actions>
+				<Action name="get">
+					<Doc>Obtain the current associated state.</Doc>
+					<SimpleType type="boolean" />
+				</Action>
+				<Action name="setTarget">
+					<Doc>Set the associated state to the specified value.</Doc>
+					<Arg name="value">
+						<Doc>The desired value of the associated state.</Doc>
+						<SimpleType type="boolean" />
+					</Arg>
+				</Action>
+			</Actions>
+		</ModuleClass>
+	</Modules>
 
 </Domain>
diff --git a/SDT/schema3.0/test/dal-eg.xml b/SDT/schema3.0/test/dal-eg.xml
index 0fceb3a..e609e56 100644
--- a/SDT/schema3.0/test/dal-eg.xml
+++ b/SDT/schema3.0/test/dal-eg.xml
@@ -14,11 +14,6 @@
   <Devices>
 
     <Device id="switch.power">
-      <DeviceInfo>
-	<Name>PowerSwitch</Name>
-	<!-- The Vendor field should probably be part of the domain -->
-	<Vendor>Telekom Innovation Laboratories</Vendor>
-      </DeviceInfo>
       
       <Doc>
 	This device is intended as a demonstration of how to use the
@@ -27,6 +22,11 @@
 	<tt>on</tt> and <tt>off</tt>. This is clearly a candidate for the 
 	module class <tt>BooleanState</tt>.
       </Doc>
+      <DeviceInfo>
+		<Name>PowerSwitch</Name>
+		<!-- The Vendor field should probably be part of the domain -->
+		<Vendor>Telekom Innovation Laboratories</Vendor>
+      </DeviceInfo>
 
       <Modules>
 	<Module name="proprietaryPower">
@@ -47,22 +47,21 @@
 		Turn the switch off.
 	      </Doc>
 	    </Action>
-	    <Action name="state" type="string">
-	      <Doc>
-		Query the state of the switch. Returns the string "<tt>on</tt>"
-		or "<tt>off</tt>".
-	      </Doc>
+	    <Action name="state">
+		  	<Doc>Query the state of the switch. Returns the string "<tt>on</tt>" or "<tt>off</tt>".</Doc>
+           	<SimpleType type="string" />
 	    </Action>
 	  </Actions>
 
 	  <Events>
 	  	<Event name="switchEvent">
+		  <Doc>An event that indicates the new state of the switch.
+		  </Doc>
 		  <Data>
-		    <DataPoint name="state" type="boolean" writable="false">
+		    <DataPoint name="state" writable="false">
+	          <SimpleType type="boolean" />
 	 		</DataPoint>
 		  </Data>
-		  <Doc>An event that indicates the new state of the switch.
-		  </Doc>
 	  	</Event>
 	  </Events>
 	</Module>
diff --git a/SDT/schema3.0/test/mseeb.xml b/SDT/schema3.0/test/mseeb.xml
index 6f810ee..8253c23 100644
--- a/SDT/schema3.0/test/mseeb.xml
+++ b/SDT/schema3.0/test/mseeb.xml
@@ -77,29 +77,29 @@
                 <tt>BooleanState</tt> is the preferred module for modelling a functionality corresponding to an underlying binary state.This module should be used to abstract away from the actual datatype and values in question. Note that the module does not define whether the execution mode is blocking or non-blocking.
             </Doc>
             <Actions>
-                <Action name="get" type="boolean" optional="true">
+                <Action name="get" optional="true">
                     <Doc>
                         Obtain the current associated state.
                     </Doc>
+                    <SimpleType type="boolean" />
                 </Action>
                 <Action name="setTarget">
                     <Doc>
                         Set the associated state to the specified value.
                     </Doc>
-                    <Arg name="value" type="boolean">
-                        <DataType>
-                            <PrimitiveDataType type="boolean" />
-                        </DataType>
+                    <Arg name="value">
                         <Doc>
                         The desired value of the associated state.
                         </Doc>
+                        <SimpleType type="boolean" />
                     </Arg>
                 </Action>
           </Actions>
           <Events>
                 <Event name="stateChanged" optional="true">
                     <Data>
-                        <DataPoint name="state" optional="true" type="boolean">
+                        <DataPoint name="state" optional="true">
+                    		<SimpleType type="boolean" />
                         </DataPoint>
                     </Data>
                 </Event>      
@@ -114,6 +114,9 @@
 <!-- The Device contains several sub-devices and offers one action on its own. -->
 
         <Device id="MSEEB.root">
+            <Doc>
+                This device is intended as a demonstration of how to define a Root Device with multiple sub-devices.
+            </Doc>
             <DeviceInfo>
                 <Name>Multi Socket Electrical-Extension-Block</Name>
                 <Vendor>HGI</Vendor>
@@ -121,9 +124,6 @@
                 <VendorURL>http://www.homegatewayinitative.org</VendorURL>
                 <SerialNumber>1234.5</SerialNumber>
             </DeviceInfo>
-            <Doc>
-                This device is intended as a demonstration of how to define a Root Device with multiple sub-devices.
-            </Doc>
 
 <!-- These are the modules for the device:
     - Switch on/off all contained switches. It inherits from hgi.dal.core.BooleanState.
@@ -138,23 +138,40 @@
                         The action "BooleanState:get" returns "true" when any of the sub-devices is in the state "on", otherwise it returns "false".
                     </Doc>
                 </Module>
+                <Module name="power">
+                    <Actions>
+                    	<Action name="getPowerConsumption">
+                            <Doc>Get the power consumption.</Doc>
+                			<Struct name="values">
+                				<Array name="consumption">
+                					<SimpleType type="float" />
+                				</Array>
+                				<Array name="timeFrame">
+                					<SimpleType type="datetime" />
+                				</Array>
+                			</Struct>
+                    	</Action>
+                    </Actions>
+                </Module>
 
                 <Module name="extensionBlockDataPoints">
                     <Data>
                         <DataPoint  name="firmwareVersion" 
-                                    type="string" 
                                     writable="false">
                             <Doc>
                                 This datapoint represents the firmware version of the extension block.
                             </Doc>
+                            <SimpleType type="string" />
                         </DataPoint>
                         
                         <DataPoint  name="powerSwitchNames"
-                                    type="array"
                                     writable="false">
                             <Doc>
                                 This datapoint is an array of strings with the names of the contained devices.
                             </Doc>
+                            <Array>
+                                <SimpleType type="string" />
+                            </Array>
                         </DataPoint>
                     </Data>
                 </Module>
@@ -168,13 +185,13 @@
 -->
 
                 <SubDevice id="switch.power.1">
+                    <Doc>
+                        This sub device is intended as a demonstration of how to use the abstract modules defined in the <em>HGI Core</em> domain.
+                    </Doc>
                     <DeviceInfo>
                         <Name>PowerSwitch 1</Name>
                         <Vendor>HGI</Vendor>
                     </DeviceInfo>
-                    <Doc>
-                        This sub device is intended as a demonstration of how to use the abstract modules defined in the <em>HGI Core</em> domain.
-                    </Doc>
                     <Modules>
                         <Module name="power">
                             <extends domain="hgi.dal.core" class="BooleanState"/>
@@ -185,13 +202,13 @@
 <!-- This is the second power switch of the extension block. -->
 
                 <SubDevice id="switch.power.2">
+                    <Doc>
+                        This sub device is intended as a demonstration of how to use the abstract modules defined in the <em>HGI Core</em> domain.
+                    </Doc>
                     <DeviceInfo>
                         <Name>PowerSwitch 2</Name>
                         <Vendor>HGI</Vendor>
                     </DeviceInfo>
-                    <Doc>
-                        This sub device is intended as a demonstration of how to use the abstract modules defined in the <em>HGI Core</em> domain.
-                    </Doc>
                     <Modules>
                         <Module name="power">
                             <extends domain="hgi.dal.core" class="BooleanState"/>
-- 
GitLab