summaryrefslogtreecommitdiff
path: root/xsd-tests/schema/attribute
diff options
context:
space:
mode:
Diffstat (limited to 'xsd-tests/schema/attribute')
-rw-r--r--xsd-tests/schema/attribute/.gitignore3
-rw-r--r--xsd-tests/schema/attribute/buildfile27
-rw-r--r--xsd-tests/schema/attribute/driver.cxx11
-rw-r--r--xsd-tests/schema/attribute/global.xsd21
-rw-r--r--xsd-tests/schema/attribute/local.xsd37
-rw-r--r--xsd-tests/schema/attribute/ref.xsd42
6 files changed, 141 insertions, 0 deletions
diff --git a/xsd-tests/schema/attribute/.gitignore b/xsd-tests/schema/attribute/.gitignore
new file mode 100644
index 0000000..88cd012
--- /dev/null
+++ b/xsd-tests/schema/attribute/.gitignore
@@ -0,0 +1,3 @@
+global.?xx
+local.?xx
+ref.?xx
diff --git a/xsd-tests/schema/attribute/buildfile b/xsd-tests/schema/attribute/buildfile
new file mode 100644
index 0000000..00e5410
--- /dev/null
+++ b/xsd-tests/schema/attribute/buildfile
@@ -0,0 +1,27 @@
+# file : schema/attribute/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}
+
+fs = global local ref
+
+exe{driver}: {hxx cxx}{* -{$fs}} {hxx cxx}{$fs} $libs
+
+for f: $fs
+{
+ <{hxx cxx}{$f}>: xsd{$f} $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/attribute/driver.cxx b/xsd-tests/schema/attribute/driver.cxx
new file mode 100644
index 0000000..3d29b36
--- /dev/null
+++ b/xsd-tests/schema/attribute/driver.cxx
@@ -0,0 +1,11 @@
+// file : schema/attribute/driver.cxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include "ref.hxx"
+#include "global.hxx"
+#include "local.hxx"
+
+int
+main (int, char*[])
+{
+}
diff --git a/xsd-tests/schema/attribute/global.xsd b/xsd-tests/schema/attribute/global.xsd
new file mode 100644
index 0000000..e2dcc93
--- /dev/null
+++ b/xsd-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/xsd-tests/schema/attribute/local.xsd b/xsd-tests/schema/attribute/local.xsd
new file mode 100644
index 0000000..7a7a480
--- /dev/null
+++ b/xsd-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/xsd-tests/schema/attribute/ref.xsd b/xsd-tests/schema/attribute/ref.xsd
new file mode 100644
index 0000000..d806ff3
--- /dev/null
+++ b/xsd-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="Foo2">
+ <xsd:attribute ref="foo"/>
+ </xsd:complexType>
+
+
+
+ <!-- Forward reference to a yet undeclared attribute. -->
+
+ <xsd:complexType name="Bar3">
+ <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="Baz3">
+ <xsd:attribute ref="baz"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="Baz2">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+</xsd:schema>