From 3808e367b6b22dbc75057f61aa5d3fe69d4a70b4 Mon Sep 17 00:00:00 2001
From: ankraft <an.kraft@googlemail.com>
Date: Wed, 22 Jan 2020 18:10:06 +0100
Subject: [PATCH] Added minOccurs/maxOccurs to xsd. Added test xml

---
 SDT/schema4.0/etc/domain.rnc               |  4 ++++
 SDT/schema4.0/src/domain.rng               | 20 ++++++++++++++++++++
 SDT/schema4.0/src/domain.xsd               |  4 ++++
 SDT/schema4.0/test/min-max-occurs-test.xml | 16 ++++++++++++++++
 4 files changed, 44 insertions(+)
 create mode 100644 SDT/schema4.0/test/min-max-occurs-test.xml

diff --git a/SDT/schema4.0/etc/domain.rnc b/SDT/schema4.0/etc/domain.rnc
index 35adcaa..0b1a4d1 100644
--- a/SDT/schema4.0/etc/domain.rnc
+++ b/SDT/schema4.0/etc/domain.rnc
@@ -109,6 +109,8 @@ SubDevicesRef =
     element SubDevice {
       attribute id { xsd:Name },
       attribute semanticURI { xsd:anyURI }?,
+      attribute minOccurs { text }?,
+      attribute maxOccurs { text }?,
       DocDef,
       PropertiesDef?,
       ModuleClassesDef?
@@ -120,6 +122,8 @@ ModuleClassesDef =
       attribute name { xsd:Name },
       attribute optional { xsd:boolean }?,
       attribute semanticURI { xsd:anyURI }?,
+      attribute minOccurs { text }?,
+      attribute maxOccurs { text }?,
       DocDef,
       ExtendDef?,
       PropertiesDef?,
diff --git a/SDT/schema4.0/src/domain.rng b/SDT/schema4.0/src/domain.rng
index 8427bee..267bc6d 100644
--- a/SDT/schema4.0/src/domain.rng
+++ b/SDT/schema4.0/src/domain.rng
@@ -314,6 +314,16 @@
 							<data type="anyURI"/>
 						</attribute>
 					</optional>
+					<optional>
+						<attribute name="minOccurs">
+							<text/>
+						</attribute>
+					</optional>
+					<optional>
+						<attribute name="maxOccurs">
+							<text/>
+						</attribute>
+					</optional>
 					<ref name="DocDef"/>
 					<optional>
 						<ref name="PropertiesDef"/>
@@ -344,6 +354,16 @@
 							<data type="anyURI"/>
 						</attribute>
 					</optional>
+					<optional>
+						<attribute name="minOccurs">
+							<text/>
+						</attribute>
+					</optional>
+					<optional>
+						<attribute name="maxOccurs">
+							<text/>
+						</attribute>
+					</optional>
 					<ref name="DocDef"/>
 					<optional>
 						<ref name="ExtendDef" />
diff --git a/SDT/schema4.0/src/domain.xsd b/SDT/schema4.0/src/domain.xsd
index 3c25016..ff074e9 100644
--- a/SDT/schema4.0/src/domain.xsd
+++ b/SDT/schema4.0/src/domain.xsd
@@ -247,6 +247,8 @@
           </xs:sequence>
           <xs:attribute name="id" use="required" type="xs:Name"/>
           <xs:attribute name="semanticURI" type="xs:anyURI"/>
+          <xs:attribute name="minOccurs"/>
+          <xs:attribute name="maxOccurs"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -272,6 +274,8 @@
           <xs:attribute name="name" use="required" type="xs:Name"/>
           <xs:attribute name="optional" type="xs:boolean"/>
           <xs:attribute name="semanticURI" type="xs:anyURI"/>
+          <xs:attribute name="minOccurs"/>
+          <xs:attribute name="maxOccurs"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
diff --git a/SDT/schema4.0/test/min-max-occurs-test.xml b/SDT/schema4.0/test/min-max-occurs-test.xml
new file mode 100644
index 0000000..516ac02
--- /dev/null
+++ b/SDT/schema4.0/test/min-max-occurs-test.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<Domain xmlns="http://www.onem2m.org/xml/sdt/4.0" xmlns:xi="http://www.w3.org/2001/XInclude" id="min-mac-occurs-test" >
+	<DeviceClasses>
+		<DeviceClass id="Test">
+			<Doc>This is a test device.</Doc>
+			<SubDevices>
+				<SubDevice id="aSubDevice" minOccurs="1" maxOccurs="unbound">
+					<ModuleClasses>
+						<ModuleClass name="aSubDeviceModuleClass" minOccurs="0" maxOccurs="10">
+						</ModuleClass>
+					</ModuleClasses>
+				</SubDevice>
+			</SubDevices>
+		</DeviceClass>
+	</DeviceClasses>
+</Domain>
-- 
GitLab