summaryrefslogtreecommitdiff
path: root/xsd-tests/schema/enumeration
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-tests/schema/enumeration')
-rw-r--r--xsd-tests/schema/enumeration/buildfile22
-rw-r--r--xsd-tests/schema/enumeration/driver.cxx9
-rw-r--r--xsd-tests/schema/enumeration/test.xsd89
3 files changed, 120 insertions, 0 deletions
diff --git a/xsd-tests/schema/enumeration/buildfile b/xsd-tests/schema/enumeration/buildfile
new file mode 100644
index 0000000..efb6b9e
--- /dev/null
+++ b/xsd-tests/schema/enumeration/buildfile
@@ -0,0 +1,22 @@
+# file : schema/enumeration/buildfile
+# license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+# Just make sure that the schema files and the xsd-generated C++ mappings are
+# compilable.
+#
+import libs = libxsd%lib{xsd}
+import libs += libxerces-c%lib{xerces-c}
+
+exe{driver}: {hxx cxx}{* -test} {hxx cxx}{test} $libs
+
+<{hxx cxx}{test}>: xsd{test} $xsd
+{{
+ diag xsd ($<[0]) # @@ TMP
+
+ $xsd cxx-tree --std c++11 \
+ --root-element-all \
+ --output-dir $out_base \
+ $path($<[0])
+}}
+
+cxx.poptions =+ "-I$out_base"
diff --git a/xsd-tests/schema/enumeration/driver.cxx b/xsd-tests/schema/enumeration/driver.cxx
new file mode 100644
index 0000000..406c8ab
--- /dev/null
+++ b/xsd-tests/schema/enumeration/driver.cxx
@@ -0,0 +1,9 @@
+// file : schema/enumeration/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "test.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/enumeration/test.xsd b/xsd-tests/schema/enumeration/test.xsd
new file mode 100644
index 0000000..b8253d9
--- /dev/null
+++ b/xsd-tests/schema/enumeration/test.xsd
@@ -0,0 +1,89 @@
+<?xml version="1.0" ?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- string-based -->
+
+ <xsd:simpleType name="StringEnum">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="one"/>
+ <xsd:enumeration value="two"/>
+ <xsd:enumeration value="three"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="StringSimple">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <!-- inheritance of a enum from a simple type -->
+ <xsd:simpleType name="StringSimpleRestriction">
+ <xsd:restriction base="test:StringSimple">
+ <xsd:enumeration value="one"/>
+ <xsd:enumeration value="two"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- inheritance of a enum from a strig-based enum -->
+ <xsd:simpleType name="StringEnumRestriction">
+ <xsd:restriction base="test:StringEnum">
+ <xsd:enumeration value="one"/>
+ <xsd:enumeration value="two"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- inheritance of a complex type from a string-based enum -->
+ <xsd:complexType name="StringComplex">
+ <xsd:simpleContent>
+ <xsd:extension base="test:StringEnumRestriction">
+ <xsd:attribute name="lang" type="xsd:language"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+
+ <!-- non string-based -->
+
+ <xsd:simpleType name="IntEnum">
+ <xsd:restriction base="xsd:int">
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="2"/>
+ <xsd:enumeration value="3"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="IntSimple">
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+
+ <!-- inheritance of a enum from a simple type -->
+ <xsd:simpleType name="IntSimpleRestriction">
+ <xsd:restriction base="test:IntSimple">
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="2"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- inheritance of a enum from a enum -->
+ <xsd:simpleType name="IntEnumRestriction">
+ <xsd:restriction base="test:IntEnum">
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="2"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- inheritance of a complex type from a enum -->
+ <xsd:complexType name="IntComplex">
+ <xsd:simpleContent>
+ <xsd:extension base="test:IntEnumRestriction">
+ <xsd:attribute name="lang" type="xsd:language"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+
+</xsd:schema>