diff --git a/SDT/schema4.0/etc/domain.rnc b/SDT/schema4.0/etc/domain.rnc index 88a42191f1c0dae9f8dd5363c76a701b8d48de07..d30de5934d3309fa6f6d272cd89004fb28e0053f 100644 --- a/SDT/schema4.0/etc/domain.rnc +++ b/SDT/schema4.0/etc/domain.rnc @@ -47,7 +47,7 @@ DataTypeDef = attribute name { text }?, attribute unitOfMeasure { text }?, DocDef, - (StructType | ArrayType | SimpleType), + (StructType | ArrayType | SimpleType | EnumType), ConstraintsDef? } StructType = element Struct { DataTypeDef+ } @@ -56,6 +56,7 @@ SimpleType = element SimpleType { attribute type { BasicType } } +EnumType = element EnumType { EnumValueDef+ } BasicType = "integer" | "boolean" @@ -69,6 +70,13 @@ BasicType = | "blob" | "uri" | "void" +EnumValueDef = + element EnumValue { + attribute name { text }, + attribute value { text }, + attribute type { BasicType }?, + DocDef + } ConstraintsDef = element Constraints { element Constraint { diff --git a/SDT/schema4.0/src/domain.rng b/SDT/schema4.0/src/domain.rng index 3f5e1291d3be0061700134a37cacb839e50d30d4..188fa93b07e2dbda2783c6bbd7720ddf51993ae5 100644 --- a/SDT/schema4.0/src/domain.rng +++ b/SDT/schema4.0/src/domain.rng @@ -121,6 +121,7 @@ <ref name="StructType" /> <ref name="ArrayType" /> <ref name="SimpleType" /> + <ref name="EnumType" /> </choice> <optional> <ref name="ConstraintsDef"/> @@ -152,6 +153,15 @@ </attribute> </element> </define> + + + <define name="EnumType"> + <element name="EnumType"> + <oneOrMore> + <ref name="EnumValueDef" /> + </oneOrMore> + </element> + </define> <define name="BasicType"> @@ -172,6 +182,23 @@ </define> + <define name="EnumValueDef"> + <element name="EnumValue"> + <attribute name="name"> + <text/> + </attribute> + <attribute name="value"> + <text/> + </attribute> + <optional> + <attribute name="type"> + <ref name="BasicType"/> + </attribute> + </optional> + <ref name="DocDef"/> + </element> + </define> + <define name="ConstraintsDef"> <element name="Constraints"> <oneOrMore> diff --git a/SDT/schema4.0/src/domain.xsd b/SDT/schema4.0/src/domain.xsd index 02696bf77a96783fdf7f509a34ccedca948287f4..72a77173bbc5cc6eb1e70d36642dc1e22ea44119 100644 --- a/SDT/schema4.0/src/domain.xsd +++ b/SDT/schema4.0/src/domain.xsd @@ -95,6 +95,7 @@ <xs:element ref="Struct"/> <xs:element ref="Array"/> <xs:element ref="SimpleType"/> + <xs:element ref="EnumType"/> </xs:choice> <xs:element minOccurs="0" ref="Constraints"/> </xs:sequence> @@ -121,6 +122,13 @@ <xs:attribute name="type" use="required" type="BasicType"/> </xs:complexType> </xs:element> + <xs:element name="EnumType"> + <xs:complexType> + <xs:sequence> + <xs:element maxOccurs="unbounded" ref="EnumValue"/> + </xs:sequence> + </xs:complexType> + </xs:element> <xs:simpleType name="BasicType"> <xs:restriction base="xs:token"> <xs:enumeration value="integer"/> @@ -137,6 +145,14 @@ <xs:enumeration value="void"/> </xs:restriction> </xs:simpleType> + <xs:element name="EnumValue"> + <xs:complexType> + <xs:group ref="DocDef"/> + <xs:attribute name="name" use="required"/> + <xs:attribute name="value" use="required"/> + <xs:attribute name="type" type="BasicType"/> + </xs:complexType> + </xs:element> <xs:element name="Constraints"> <xs:complexType> <xs:sequence> diff --git a/SDT/schema4.0/test/enumtype-test.xml b/SDT/schema4.0/test/enumtype-test.xml new file mode 100644 index 0000000000000000000000000000000000000000..2b7a418def6cb62db55e0737aabda3c6644a71d4 --- /dev/null +++ b/SDT/schema4.0/test/enumtype-test.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Test the void BasicType --> + +<Domain id="enumtype-test" xmlns="http://homegatewayinitiative.org/xml/dal/4.0" xmlns:xi="http://www.w3.org/2001/XInclude"> + <ModuleClasses> + <ModuleClass name="TestEnumType"> + <Data> + <DataPoint name="TestEnumTypeDataPoint" writable="true"> + <DataType> + <EnumType> + <EnumValue name="red" value="1" type="integer" /> + <EnumValue name="green" value="2" /> + <EnumValue name="blue" value="3" /> + </EnumType> + </DataType> + </DataPoint> + </Data> + </ModuleClass> + </ModuleClasses> +</Domain> \ No newline at end of file