Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
MAS
SDT
Commits
89325bfd
Commit
89325bfd
authored
Jan 30, 2019
by
ankraft
Browse files
Added support for EnumType. Added test case.
parent
f80296ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
1 deletion
+72
-1
SDT/schema4.0/etc/domain.rnc
SDT/schema4.0/etc/domain.rnc
+9
-1
SDT/schema4.0/src/domain.rng
SDT/schema4.0/src/domain.rng
+27
-0
SDT/schema4.0/src/domain.xsd
SDT/schema4.0/src/domain.xsd
+16
-0
SDT/schema4.0/test/enumtype-test.xml
SDT/schema4.0/test/enumtype-test.xml
+20
-0
No files found.
SDT/schema4.0/etc/domain.rnc
View file @
89325bfd
...
...
@@ -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 {
...
...
SDT/schema4.0/src/domain.rng
View file @
89325bfd
...
...
@@ -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>
...
...
SDT/schema4.0/src/domain.xsd
View file @
89325bfd
...
...
@@ -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>
...
...
SDT/schema4.0/test/enumtype-test.xml
0 → 100644
View file @
89325bfd
<?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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment