summaryrefslogtreecommitdiff
path: root/tests/schema
diff options
context:
space:
mode:
Diffstat (limited to 'tests/schema')
-rw-r--r--tests/schema/anonymous/test.xsd143
-rw-r--r--tests/schema/any-attribute/test.xsd22
-rw-r--r--tests/schema/any-type/test.xsd22
-rw-r--r--tests/schema/any/fail.xsd19
-rw-r--r--tests/schema/any/test.xsd19
-rw-r--r--tests/schema/attribute-group/global.xsd50
-rw-r--r--tests/schema/attribute/global.xsd21
-rw-r--r--tests/schema/attribute/local.xsd37
-rw-r--r--tests/schema/attribute/ref.xsd42
-rw-r--r--tests/schema/cardinality/test.xsd46
-rw-r--r--tests/schema/chameleon/includer.xsd17
-rw-r--r--tests/schema/chameleon/schemas/includee.xsd12
-rw-r--r--tests/schema/enumeration/test.xsd89
-rw-r--r--tests/schema/forward/test.xsd32
-rw-r--r--tests/schema/group/global.xsd39
-rw-r--r--tests/schema/group/test.xsd148
-rw-r--r--tests/schema/import/importer.xsd20
-rw-r--r--tests/schema/import/schemas/importee.xsd15
-rw-r--r--tests/schema/include/includer.xsd17
-rw-r--r--tests/schema/include/schemas/includee.xsd14
-rw-r--r--tests/schema/inheritance/cycle.xsd34
-rw-r--r--tests/schema/inheritance/sourced-forward/includee.xsd10
-rw-r--r--tests/schema/inheritance/sourced-forward/includer.xsd14
-rw-r--r--tests/schema/list/anonymous/test.xsd16
-rw-r--r--tests/schema/list/any-simple-type/test.xsd12
-rw-r--r--tests/schema/list/driver.cxx13
-rw-r--r--tests/schema/list/test.xsd72
-rw-r--r--tests/schema/no-namespace/test.xsd15
-rw-r--r--tests/schema/recursive/test.xsd43
-rw-r--r--tests/schema/ref-type/idref.xsd42
-rw-r--r--tests/schema/ref-type/idrefs.xsd43
-rw-r--r--tests/schema/ref-type/invalid-0.xsd17
-rw-r--r--tests/schema/ref-type/invalid-1.xsd11
-rw-r--r--tests/schema/restriction/test.xsd67
-rw-r--r--tests/schema/union/test.xsd65
35 files changed, 1298 insertions, 0 deletions
diff --git a/tests/schema/anonymous/test.xsd b/tests/schema/anonymous/test.xsd
new file mode 100644
index 0000000..cba3300
--- /dev/null
+++ b/tests/schema/anonymous/test.xsd
@@ -0,0 +1,143 @@
+<?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">
+
+ <!-- Test 'type' name escaping. -->
+ <xsd:element name="type">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <!-- Anonymous type via global element. -->
+ <xsd:element name="global_element">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <!-- Anonymous type via global attribute. -->
+ <xsd:attribute name="global_attribute">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+
+
+ <!-- Anonymous type via local element. -->
+ <xsd:complexType name="local_element_type">
+ <xsd:sequence>
+ <xsd:element name="local_element">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+
+ <!-- Anonymous type via local attribute. -->
+ <xsd:complexType name="local_attribute_type">
+ <xsd:attribute name="local_attribute">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+
+<!--
+
+ Various weird anonymous type combinations (some of them are fruits of a
+ really sick imagination).
+
+-->
+
+ <xsd:element name="tasks">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:periodicTask"/>
+ <xsd:element ref="test:braindamageTask"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="periodicTask">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:tasks"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="braindamageTask">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:tasks"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:complexType name="PropertySeq">
+ <xsd:sequence>
+ <xsd:element name="propery">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="value">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="typecode">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="string"/>
+ <xsd:enumeration value="integer"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ <xsd:element name="content" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:element name="periods">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="period" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:element name="typecode">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="string"/>
+ <xsd:enumeration value="integer"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+
+
+</xsd:schema>
diff --git a/tests/schema/any-attribute/test.xsd b/tests/schema/any-attribute/test.xsd
new file mode 100644
index 0000000..55419c4
--- /dev/null
+++ b/tests/schema/any-attribute/test.xsd
@@ -0,0 +1,22 @@
+<?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">
+
+
+ <xsd:complexType name="type">
+ <xsd:attribute name="a" type="xsd:string"/>
+ <xsd:anyAttribute namespace="##other" processContents="skip"/>
+ <xsd:attributeGroup ref="test:agroup"/>
+ </xsd:complexType>
+
+ <xsd:attributeGroup name="agroup">
+ <xsd:attribute name="b" type="xsd:string"/>
+ <xsd:anyAttribute namespace="##any" processContents="skip"/>
+ </xsd:attributeGroup>
+
+ <xsd:element name="root" type="test:type"/>
+
+</xsd:schema>
diff --git a/tests/schema/any-type/test.xsd b/tests/schema/any-type/test.xsd
new file mode 100644
index 0000000..9e3ff79
--- /dev/null
+++ b/tests/schema/any-type/test.xsd
@@ -0,0 +1,22 @@
+<?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">
+
+ <xsd:complexType name="person">
+ <xsd:sequence>
+ <xsd:element name="name"/> <!-- type="anyType" -->
+ <xsd:element name="name2" type="xsd:anyType" minOccurs="0"/>
+ <xsd:element name="name3" type="xsd:anyType" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id"/> <!-- type="anySimpleType" -->
+ <xsd:attribute name="id2" type="xsd:anySimpleType" use="required"/>
+ </xsd:complexType>
+
+ <xsd:element name="person" type="test:person"/>
+
+ <xsd:element name="name"/> <!-- type="anyType" -->
+
+</xsd:schema>
diff --git a/tests/schema/any/fail.xsd b/tests/schema/any/fail.xsd
new file mode 100644
index 0000000..2eb9513
--- /dev/null
+++ b/tests/schema/any/fail.xsd
@@ -0,0 +1,19 @@
+<?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">
+
+ <xsd:element name="foo" type="xsd:string"/>
+
+ <xsd:complexType name="person">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element ref="test:foo"/>
+ <xsd:any namespace="##any" processContents="strict"/>
+ <xsd:any namespace="http://www.codesynthesis.com/xmlns/test" processContents="strict"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/tests/schema/any/test.xsd b/tests/schema/any/test.xsd
new file mode 100644
index 0000000..ff896fd
--- /dev/null
+++ b/tests/schema/any/test.xsd
@@ -0,0 +1,19 @@
+<?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">
+
+ <xsd:complexType name="person">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:any namespace="##other" processContents="strict" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID"/>
+ <xsd:anyAttribute namespace="##other" processContents="strict"/>
+ </xsd:complexType>
+
+ <xsd:element name="person" type="test:person"/>
+
+</xsd:schema>
diff --git a/tests/schema/attribute-group/global.xsd b/tests/schema/attribute-group/global.xsd
new file mode 100644
index 0000000..6ee0539
--- /dev/null
+++ b/tests/schema/attribute-group/global.xsd
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Simple case. -->
+
+ <xsd:attributeGroup name="gfoo_1">
+ <xsd:attribute name="foo_1_1" type="xsd:string"/>
+ <xsd:attribute name="foo_1_2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+ <xsd:attributeGroup name="gfoo_2">
+ <xsd:attributeGroup ref="gfoo_1"/>
+ <xsd:attribute name="foo_2_1" type="xsd:string"/>
+ <xsd:attribute name="foo_2_2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+ <xsd:complexType name="Foo">
+ <xsd:attributeGroup ref="gfoo_2"/>
+ </xsd:complexType>
+
+
+
+ <!-- Forward reference. -->
+
+ <xsd:attributeGroup name="gbar_3">
+ <xsd:attribute name="bar_3_1" type="xsd:string"/>
+ <xsd:attribute name="bar_3_2" type="xsd:string"/>
+ <xsd:attributeGroup ref="gbar_1"/>
+ </xsd:attributeGroup>
+
+ <xsd:complexType name="Bar">
+ <xsd:attributeGroup ref="gbar_2"/>
+ </xsd:complexType>
+
+ <xsd:attributeGroup name="gbar_2">
+ <xsd:attributeGroup ref="gbar_3"/>
+ <xsd:attribute name="bar_2_1" type="xsd:string"/>
+ <xsd:attribute name="bar_2_2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+ <xsd:attributeGroup name="gbar_1">
+ <xsd:attribute name="bar_1_1" type="xsd:string"/>
+ <xsd:attribute name="bar_1_2" type="xsd:string"/>
+ </xsd:attributeGroup>
+
+</xsd:schema>
diff --git a/tests/schema/attribute/global.xsd b/tests/schema/attribute/global.xsd
new file mode 100644
index 0000000..e2dcc93
--- /dev/null
+++ b/tests/schema/attribute/global.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Typed with named type. -->
+
+ <xsd:attribute name="foo" type="xsd:string"/>
+
+
+ <!-- Typed with anonymous type. -->
+
+ <xsd:attribute name="bar">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+
+</xsd:schema>
diff --git a/tests/schema/attribute/local.xsd b/tests/schema/attribute/local.xsd
new file mode 100644
index 0000000..7a7a480
--- /dev/null
+++ b/tests/schema/attribute/local.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+
+ <!-- Typed with named type. -->
+
+ <xsd:complexType name="Foo">
+ <xsd:attribute name="foo" type="xsd:string"/>
+ </xsd:complexType>
+
+
+ <!-- Forward reference to a yet undeclared type. -->
+
+ <xsd:complexType name="Bar">
+ <xsd:attribute name="bar" type="Bar2"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="Bar2">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+
+ <!-- Typed with anonymous type. -->
+
+ <xsd:complexType name="Baz">
+ <xsd:attribute name="baz">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/tests/schema/attribute/ref.xsd b/tests/schema/attribute/ref.xsd
new file mode 100644
index 0000000..f6c3c10
--- /dev/null
+++ b/tests/schema/attribute/ref.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+
+ <!-- Easy case. -->
+
+ <xsd:attribute name="foo" type="xsd:string"/>
+
+ <xsd:complexType name="Foo">
+ <xsd:attribute ref="foo"/>
+ </xsd:complexType>
+
+
+
+ <!-- Forward reference to a yet undeclared attribute. -->
+
+ <xsd:complexType name="Bar">
+ <xsd:attribute ref="bar"/>
+ </xsd:complexType>
+
+ <xsd:attribute name="bar" type="xsd:string"/>
+
+
+
+ <!-- Reference to an attribute with a forward reference to a yet
+ undeclared type. -->
+
+ <xsd:attribute name="baz" type="Baz2"/>
+
+ <xsd:complexType name="Baz">
+ <xsd:attribute ref="baz"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="Baz2">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/schema/cardinality/test.xsd b/tests/schema/cardinality/test.xsd
new file mode 100644
index 0000000..b27f923
--- /dev/null
+++ b/tests/schema/cardinality/test.xsd
@@ -0,0 +1,46 @@
+<?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">
+
+ <!--
+ This test tries to cover various cardinality cases with
+ built-in and user-defined types.
+ -->
+
+ <xsd:complexType name="Foo">
+ <xsd:sequence>
+ <xsd:element name="foo" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Bar">
+ <xsd:sequence>
+
+ <xsd:element name="one-int" type="xsd:int"/>
+ <xsd:element name="opt-int" type="xsd:int" minOccurs="0"/>
+ <xsd:element name="seq-int" type="xsd:int" maxOccurs="unbounded"/>
+
+ <xsd:element name="one-string" type="xsd:string"/>
+ <xsd:element name="opt-string" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="seq-string" type="xsd:string" maxOccurs="unbounded"/>
+
+ <xsd:element name="one-foo" type="test:Foo"/>
+ <xsd:element name="opt-foo" type="test:Foo" minOccurs="0"/>
+ <xsd:element name="seq-foo" type="test:Foo" maxOccurs="unbounded"/>
+
+ </xsd:sequence>
+
+ <xsd:attribute name="one-int-a" type="xsd:int" use="required"/>
+ <xsd:attribute name="opt-int-a" type="xsd:int"/>
+
+ <xsd:attribute name="one-string-a" type="xsd:string" use="required"/>
+ <xsd:attribute name="opt-string-a" type="xsd:string"/>
+
+ </xsd:complexType>
+
+ <xsd:element name="bar" type="test:Bar"/>
+
+</xsd:schema>
diff --git a/tests/schema/chameleon/includer.xsd b/tests/schema/chameleon/includer.xsd
new file mode 100644
index 0000000..c93ea18
--- /dev/null
+++ b/tests/schema/chameleon/includer.xsd
@@ -0,0 +1,17 @@
+<?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">
+
+ <xsd:include schemaLocation="schemas/includee.xsd"/>
+
+ <xsd:simpleType name="derived">
+ <xsd:restriction base="Test:base"/>
+ </xsd:simpleType>
+
+ <xsd:element name="element" type="Test:base"/>
+ <xsd:attribute name="attribute" type="Test:base"/>
+
+</xsd:schema>
diff --git a/tests/schema/chameleon/schemas/includee.xsd b/tests/schema/chameleon/schemas/includee.xsd
new file mode 100644
index 0000000..d89b9c4
--- /dev/null
+++ b/tests/schema/chameleon/schemas/includee.xsd
@@ -0,0 +1,12 @@
+<?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">
+
+ <xsd:simpleType name="base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="base_e" type="base"/>
+
+</xsd:schema>
diff --git a/tests/schema/enumeration/test.xsd b/tests/schema/enumeration/test.xsd
new file mode 100644
index 0000000..b8253d9
--- /dev/null
+++ b/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>
diff --git a/tests/schema/forward/test.xsd b/tests/schema/forward/test.xsd
new file mode 100644
index 0000000..c7cc24e
--- /dev/null
+++ b/tests/schema/forward/test.xsd
@@ -0,0 +1,32 @@
+<?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">
+
+<!--
+
+ Various weird forward reference combinations.
+
+-->
+
+ <!-- case 1 -->
+
+ <xsd:complexType name="Type1A">
+ <xsd:complexContent>
+ <xsd:extension base="test:Type1B">
+ <xsd:sequence>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="Type1B">
+ <xsd:sequence>
+ <xsd:element name="foo" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/tests/schema/group/global.xsd b/tests/schema/group/global.xsd
new file mode 100644
index 0000000..27ccadf
--- /dev/null
+++ b/tests/schema/group/global.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- Simple case. -->
+
+ <xsd:group name="gfoo">
+ <xsd:sequence>
+ <xsd:element name="foo_1" type="xsd:string"/>
+ <xsd:element name="foo_2" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:group>
+
+
+ <xsd:complexType name="Foo">
+ <xsd:group ref="gfoo"/>
+ </xsd:complexType>
+
+
+
+ <!-- Forward reference. -->
+
+ <xsd:complexType name="Bar">
+ <xsd:group ref="gbar"/>
+ </xsd:complexType>
+
+ <xsd:group name="gbar">
+ <xsd:choice>
+ <xsd:element name="bar_1" type="xsd:string"/>
+ <xsd:element ref="bar_2"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:element name="bar_2" type="xsd:string"/>
+
+</xsd:schema>
diff --git a/tests/schema/group/test.xsd b/tests/schema/group/test.xsd
new file mode 100644
index 0000000..7527cbb
--- /dev/null
+++ b/tests/schema/group/test.xsd
@@ -0,0 +1,148 @@
+<?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">
+
+ <!--
+
+ Various weird group combinations.
+
+ -->
+
+ <!-- case 1 -->
+
+ <xsd:group name="g1">
+ <xsd:sequence>
+ <xsd:element name="e1" type="xsd:string"/>
+ <xsd:element name="e2" type="xsd:long"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:complexType name="Type1">
+ <xsd:sequence>
+ <xsd:group ref="test:g1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- case 2 -->
+
+ <xsd:group name="g2">
+ <xsd:sequence>
+ <xsd:element ref="test:g2e1"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:complexType name="TypeTwo">
+ <xsd:sequence>
+ <xsd:group ref="test:g2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="g2e1" type="xsd:string"/>
+
+ <!-- case 3 -->
+
+ <xsd:complexType name="Type3">
+ <xsd:sequence>
+ <xsd:group ref="test:g3"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:group name="g3">
+ <xsd:sequence>
+ <xsd:element ref="test:g3e1"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:element name="g3e1" type="xsd:string"/>
+
+ <!-- case 4 -->
+
+ <xsd:complexType name="Type4A">
+ <xsd:sequence>
+ <xsd:group ref="test:g4" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Type4B">
+ <xsd:sequence minOccurs="0">
+ <xsd:group ref="test:g4"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:group name="g4">
+ <xsd:sequence>
+ <xsd:element name="e1" type="xsd:string"/>
+ <xsd:element name="e2" type="xsd:long" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:group>
+
+ <xsd:complexType name="Type4C">
+ <xsd:sequence>
+ <xsd:group ref="test:g4" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- case 5 -->
+
+ <xsd:group name="g5-1">
+ <xsd:choice>
+ <xsd:group ref="test:g5-2"/>
+ <xsd:element name="e1" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:group name="g5-2">
+ <xsd:choice>
+ <xsd:group ref="test:g5-3"/>
+ <xsd:element name="e2" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:group name="g5-3">
+ <xsd:choice>
+ <xsd:element name="e3" type="xsd:long"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="Type5">
+ <xsd:choice>
+ <xsd:group ref="test:g5-1"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <!-- case 6 -->
+
+ <xsd:group name="g6-3">
+ <xsd:choice>
+ <xsd:group ref="test:g6-1"/>
+ <xsd:element name="e_3_1" type="xsd:string"/>
+ <xsd:element name="e_3_2" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:complexType name="Type6">
+ <xsd:choice>
+ <xsd:group ref="test:g6-2"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:group name="g6-2">
+ <xsd:choice>
+ <xsd:group ref="test:g6-3"/>
+ <xsd:element name="e_2_1" type="xsd:string"/>
+ <xsd:element name="e_2_2" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:group name="g6-1">
+ <xsd:choice>
+ <xsd:element name="e_1_1" type="xsd:string"/>
+ <xsd:element name="e_1_2" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:group>
+
+</xsd:schema>
diff --git a/tests/schema/import/importer.xsd b/tests/schema/import/importer.xsd
new file mode 100644
index 0000000..82fc33c
--- /dev/null
+++ b/tests/schema/import/importer.xsd
@@ -0,0 +1,20 @@
+<?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"
+ xmlns:Impl="http://www.codesynthesis.com/xmlns/test/impl"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test/impl">
+
+ <!-- <xsd::element name="foo" type="xsd:string"/> -->
+
+ <xsd:import namespace="http://www.codesynthesis.com/xmlns/test" schemaLocation="schemas/importee.xsd"/>
+
+ <xsd:simpleType name="derived">
+ <xsd:restriction base="Test:base"/>
+ </xsd:simpleType>
+
+ <xsd:element name="element" type="Test:base"/>
+ <xsd:attribute name="attribute" type="Test:base"/>
+
+</xsd:schema>
diff --git a/tests/schema/import/schemas/importee.xsd b/tests/schema/import/schemas/importee.xsd
new file mode 100644
index 0000000..9b03315
--- /dev/null
+++ b/tests/schema/import/schemas/importee.xsd
@@ -0,0 +1,15 @@
+<?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">
+
+
+ <xsd:simpleType name="base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="base_e" type="test:base"/>
+
+</xsd:schema>
diff --git a/tests/schema/include/includer.xsd b/tests/schema/include/includer.xsd
new file mode 100644
index 0000000..c93ea18
--- /dev/null
+++ b/tests/schema/include/includer.xsd
@@ -0,0 +1,17 @@
+<?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">
+
+ <xsd:include schemaLocation="schemas/includee.xsd"/>
+
+ <xsd:simpleType name="derived">
+ <xsd:restriction base="Test:base"/>
+ </xsd:simpleType>
+
+ <xsd:element name="element" type="Test:base"/>
+ <xsd:attribute name="attribute" type="Test:base"/>
+
+</xsd:schema>
diff --git a/tests/schema/include/schemas/includee.xsd b/tests/schema/include/schemas/includee.xsd
new file mode 100644
index 0000000..0a928f5
--- /dev/null
+++ b/tests/schema/include/schemas/includee.xsd
@@ -0,0 +1,14 @@
+<?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">
+
+ <xsd:simpleType name="base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="base_e" type="test:base"/>
+
+</xsd:schema>
diff --git a/tests/schema/inheritance/cycle.xsd b/tests/schema/inheritance/cycle.xsd
new file mode 100644
index 0000000..c705311
--- /dev/null
+++ b/tests/schema/inheritance/cycle.xsd
@@ -0,0 +1,34 @@
+<?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">
+
+ <xsd:complexType name="Base">
+ <xsd:sequence>
+ <xsd:element name="e1">
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="test:Derived">
+ <xsd:sequence>
+ <xsd:element name="e2" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Derived">
+ <xsd:complexContent>
+ <xsd:extension base="test:Base">
+ <xsd:sequence>
+ <xsd:element name="e3" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/tests/schema/inheritance/sourced-forward/includee.xsd b/tests/schema/inheritance/sourced-forward/includee.xsd
new file mode 100644
index 0000000..531027d
--- /dev/null
+++ b/tests/schema/inheritance/sourced-forward/includee.xsd
@@ -0,0 +1,10 @@
+<?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">
+
+ <xsd:simpleType name="Derived">
+ <xsd:restriction base="Base"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/schema/inheritance/sourced-forward/includer.xsd b/tests/schema/inheritance/sourced-forward/includer.xsd
new file mode 100644
index 0000000..7d18efc
--- /dev/null
+++ b/tests/schema/inheritance/sourced-forward/includer.xsd
@@ -0,0 +1,14 @@
+<?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">
+
+ <xsd:include schemaLocation="includee.xsd"/>
+
+ <xsd:simpleType name="Base">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/schema/list/anonymous/test.xsd b/tests/schema/list/anonymous/test.xsd
new file mode 100644
index 0000000..7db39ba
--- /dev/null
+++ b/tests/schema/list/anonymous/test.xsd
@@ -0,0 +1,16 @@
+<?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">
+
+ <xsd:simpleType name="IntList">
+ <xsd:list>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+ </xsd:list>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/schema/list/any-simple-type/test.xsd b/tests/schema/list/any-simple-type/test.xsd
new file mode 100644
index 0000000..29fe95c
--- /dev/null
+++ b/tests/schema/list/any-simple-type/test.xsd
@@ -0,0 +1,12 @@
+<?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">
+
+ <xsd:simpleType name="any">
+ <xsd:list itemType="xsd:anySimpleType"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/schema/list/driver.cxx b/tests/schema/list/driver.cxx
new file mode 100644
index 0000000..7bd46e9
--- /dev/null
+++ b/tests/schema/list/driver.cxx
@@ -0,0 +1,13 @@
+#include "test.hxx"
+
+typedef xmlns::test::IntList<void, int> IntListImpl;
+typedef xmlns::test::IntList<void, void> IntListVoidImpl;
+typedef xmlns::test::IntComplex<void, int, char*> IntComplexImpl;
+
+int
+main ()
+{
+ IntListImpl int_list_impl;
+ IntListVoidImpl int_list_void_impl;
+ IntComplexImpl int_complex_impl;
+}
diff --git a/tests/schema/list/test.xsd b/tests/schema/list/test.xsd
new file mode 100644
index 0000000..e16a58d
--- /dev/null
+++ b/tests/schema/list/test.xsd
@@ -0,0 +1,72 @@
+<?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">
+
+ <xsd:simpleType name="IntList">
+ <xsd:list itemType="xsd:int"/>
+ </xsd:simpleType>
+
+ <!-- local element with anonymous list inside. -->
+
+ <xsd:complexType name="Foo">
+ <xsd:sequence>
+ <xsd:element name="string-list">
+ <xsd:simpleType>
+ <xsd:list itemType="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <!-- global element with anonymous list inside. -->
+
+ <xsd:element name="string-list">
+ <xsd:simpleType>
+ <xsd:list itemType="xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+
+
+
+ <!-- global element and global list with conflicting names -->
+
+ <xsd:simpleType name="long-list">
+ <xsd:list itemType="xsd:long"/>
+ </xsd:simpleType>
+
+ <xsd:element name="long-list" type="test:long-list"/>
+
+
+ <!-- forward reference -->
+
+ <xsd:simpleType name="int-list">
+ <xsd:list itemType="test:int"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="int">
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+
+
+ <!-- inheritance from list -->
+
+ <xsd:complexType name="IntComplex">
+ <xsd:simpleContent>
+ <xsd:extension base="test:IntList">
+ <xsd:attribute name="foo" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="IntComplexEmpty">
+ <xsd:simpleContent>
+ <xsd:extension base="test:IntList">
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/tests/schema/no-namespace/test.xsd b/tests/schema/no-namespace/test.xsd
new file mode 100644
index 0000000..b426e8a
--- /dev/null
+++ b/tests/schema/no-namespace/test.xsd
@@ -0,0 +1,15 @@
+<?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">
+
+
+ <xsd:complexType name="Test">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="test" type="Test"/>
+
+</xsd:schema>
diff --git a/tests/schema/recursive/test.xsd b/tests/schema/recursive/test.xsd
new file mode 100644
index 0000000..6efc7d2
--- /dev/null
+++ b/tests/schema/recursive/test.xsd
@@ -0,0 +1,43 @@
+<?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">
+
+ <xsd:element name="BooleanExpression">
+ <xsd:complexType>
+ <xsd:choice>
+ <xsd:element name="literal" type="xsd:boolean"/>
+ <xsd:element ref="test:AND"/>
+ <xsd:element ref="test:OR"/>
+ <xsd:element ref="test:XOR"/>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="AND">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:BooleanExpression" maxOccurs="2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="OR">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:BooleanExpression" maxOccurs="2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="XOR">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="test:BooleanExpression" maxOccurs="2"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+</xsd:schema>
diff --git a/tests/schema/ref-type/idref.xsd b/tests/schema/ref-type/idref.xsd
new file mode 100644
index 0000000..49ebe40
--- /dev/null
+++ b/tests/schema/ref-type/idref.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- attribute -->
+
+ <xsd:attribute name="attribute" type="xsd:IDREF" xse:refType="test:a-author"/>
+
+ <xsd:complexType name="a-author">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="recommends" type="xsd:IDREF" xse:refType="test:a-author"/>
+ </xsd:complexType>
+
+
+ <!-- element -->
+
+ <xsd:element name="element" type="xsd:IDREF" xse:refType="test:e-author"/>
+
+ <xsd:complexType name="e-author">
+ <xsd:sequence>
+ <xsd:element name="recommends" type="xsd:IDREF" xse:refType="test:e-author"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- base -->
+
+ <xsd:simpleType name="author-ref">
+ <xsd:restriction base="xsd:IDREF" xse:refType="test:e-author"/>
+ </xsd:simpleType>
+
+
+ <!-- itemType -->
+
+ <xsd:simpleType name="author-refs">
+ <xsd:list itemType="xsd:IDREF" xse:refType="test:e-author"/>
+ </xsd:simpleType>
+
+</xsd:schema>
diff --git a/tests/schema/ref-type/idrefs.xsd b/tests/schema/ref-type/idrefs.xsd
new file mode 100644
index 0000000..b68ed03
--- /dev/null
+++ b/tests/schema/ref-type/idrefs.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- attribute -->
+
+ <xsd:attribute name="attribute" type="xsd:IDREFS" xse:refType="test:a-author"/>
+
+ <xsd:complexType name="a-author">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="recommends" type="xsd:IDREFS" xse:refType="test:a-author"/>
+ </xsd:complexType>
+
+
+ <!-- element -->
+
+ <xsd:element name="element" type="xsd:IDREFS" xse:refType="test:e-author"/>
+
+ <xsd:complexType name="e-author">
+ <xsd:sequence>
+ <xsd:element name="recommends" type="xsd:IDREFS" xse:refType="test:e-author"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- base -->
+
+ <xsd:simpleType name="author-refs">
+ <xsd:restriction base="xsd:IDREFS" xse:refType="test:e-author"/>
+ </xsd:simpleType>
+
+
+ <!-- itemType - illegal -->
+ <!--
+ <xsd:simpleType name="author-refss">
+ <xsd:list itemType="xsd:IDREFS" xse:refType="test:e-author"/>
+ </xsd:simpleType>
+ -->
+
+</xsd:schema>
diff --git a/tests/schema/ref-type/invalid-0.xsd b/tests/schema/ref-type/invalid-0.xsd
new file mode 100644
index 0000000..7ce82ed
--- /dev/null
+++ b/tests/schema/ref-type/invalid-0.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ xmlns:phony="http://www.codesynthesis.com/xmlns/phony"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- unresolvable namespace prefix -->
+
+ <xsd:attribute name="attribute1" type="xsd:IDREF" xse:refType="author"/>
+ <xsd:attribute name="attribute2" type="xsd:IDREF" xse:refType="t:author"/>
+
+ <!-- unresolvable namespace -->
+
+ <xsd:attribute name="attribute3" type="xsd:IDREF" xse:refType="phony:author"/>
+
+</xsd:schema>
diff --git a/tests/schema/ref-type/invalid-1.xsd b/tests/schema/ref-type/invalid-1.xsd
new file mode 100644
index 0000000..d989065
--- /dev/null
+++ b/tests/schema/ref-type/invalid-1.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
+ xmlns:test="http://www.codesynthesis.com/xmlns/test"
+ targetNamespace="http://www.codesynthesis.com/xmlns/test">
+
+ <!-- unresolvable type -->
+
+ <xsd:attribute name="attribute" type="xsd:IDREF" xse:refType="test:author"/>
+
+</xsd:schema>
diff --git a/tests/schema/restriction/test.xsd b/tests/schema/restriction/test.xsd
new file mode 100644
index 0000000..331ba78
--- /dev/null
+++ b/tests/schema/restriction/test.xsd
@@ -0,0 +1,67 @@
+<?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">
+
+ <!-- Simple content. -->
+
+ <xsd:complexType name="SimpleBase">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="lang" type="xsd:language"/>
+ <xsd:attribute name="note" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="SimpleType">
+ <xsd:simpleContent>
+ <xsd:restriction base="test:SimpleBase">
+ <xsd:maxLength value="255"/>
+ <xsd:attribute name="lang">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:language">
+ <xsd:enumeration value="en"/>
+ <xsd:enumeration value="es"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:restriction>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+ <!-- Complex content. -->
+
+ <xsd:complexType name="ComplexBase">
+ <xsd:sequence>
+ <xsd:element name="lang" type="xsd:language"/>
+ <xsd:element name="note" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="ComplexType">
+ <xsd:complexContent>
+ <xsd:restriction base="test:ComplexBase">
+ <xsd:sequence>
+ <xsd:element name="lang" type="xsd:language"/>
+ <xsd:element name="note" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="AnyType">
+ <xsd:complexContent>
+ <xsd:restriction base="xsd:anyType">
+ <xsd:sequence>
+ <xsd:element name="lang" type="xsd:language"/>
+ <xsd:element name="note" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/tests/schema/union/test.xsd b/tests/schema/union/test.xsd
new file mode 100644
index 0000000..706f6f2
--- /dev/null
+++ b/tests/schema/union/test.xsd
@@ -0,0 +1,65 @@
+<?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">
+
+ <xsd:simpleType name="IntUnion">
+ <xsd:union memberTypes="xsd:int xsd:string"/>
+ </xsd:simpleType>
+
+ <!-- local element with anonymous union inside. -->
+
+ <xsd:complexType name="Foo">
+ <xsd:sequence>
+ <xsd:element name="string-union">
+ <xsd:simpleType>
+ <xsd:union memberTypes="xsd:int xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <!-- global element with anonymous union inside. -->
+
+ <xsd:element name="string-union">
+ <xsd:simpleType>
+ <xsd:union memberTypes="xsd:int xsd:string"/>
+ </xsd:simpleType>
+ </xsd:element>
+
+
+
+ <!-- global element and global union with conflicting names -->
+
+ <xsd:simpleType name="long-union">
+ <xsd:union memberTypes="xsd:long xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:element name="long-union" type="test:long-union"/>
+
+
+ <!-- forward reference -->
+
+ <xsd:simpleType name="int-union">
+ <xsd:union memberTypes="test:int xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="int">
+ <xsd:restriction base="xsd:int"/>
+ </xsd:simpleType>
+
+
+ <!-- inheritance from union -->
+
+ <xsd:complexType name="IntComplex">
+ <xsd:simpleContent>
+ <xsd:extension base="test:IntUnion">
+ <xsd:attribute name="foo" type="xsd:string"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>