diff options
Diffstat (limited to 'xsd-tests/cxx/tree/chameleon')
-rw-r--r-- | xsd-tests/cxx/tree/chameleon/.gitignore | 1 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/chameleon/buildfile | 24 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/chameleon/driver.cxx | 35 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/chameleon/includee.xsd | 13 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/chameleon/includer.xsd | 12 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/chameleon/output | 3 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/chameleon/test.xml | 8 |
7 files changed, 96 insertions, 0 deletions
diff --git a/xsd-tests/cxx/tree/chameleon/.gitignore b/xsd-tests/cxx/tree/chameleon/.gitignore new file mode 100644 index 0000000..4ec7484 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/.gitignore @@ -0,0 +1 @@ +includer.?xx diff --git a/xsd-tests/cxx/tree/chameleon/buildfile b/xsd-tests/cxx/tree/chameleon/buildfile new file mode 100644 index 0000000..cec3b01 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/buildfile @@ -0,0 +1,24 @@ +# file : cxx/tree/chameleon/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -includer} {hxx ixx cxx}{includer} $libs + +exe{driver}: xml{test}: test.input = true +exe{driver}: file{output}: test.stdout = true + +<{hxx ixx cxx}{includer}>: xsd{includer includee} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --generate-ostream \ + --root-element root \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/chameleon/driver.cxx b/xsd-tests/cxx/tree/chameleon/driver.cxx new file mode 100644 index 0000000..c22ca55 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/driver.cxx @@ -0,0 +1,35 @@ +// file : cxx/tree/chameleon/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test chameleon inclusion. +// + +#include <memory> // std::auto_ptr/unique_ptr +#include <iostream> + +#include "includer.hxx" + +using namespace std; +using namespace test; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " test.xml" << endl; + return 1; + } + + try + { + XSD_AUTO_PTR<root_t> r (root (argv[1])); + + cout << *r << endl; + } + catch (xml_schema::exception const& e) + { + cerr << e << endl; + return 1; + } +} diff --git a/xsd-tests/cxx/tree/chameleon/includee.xsd b/xsd-tests/cxx/tree/chameleon/includee.xsd new file mode 100644 index 0000000..531a7d0 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/includee.xsd @@ -0,0 +1,13 @@ +<?xml version="1.0" ?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:complexType name="root_t"> + <xsd:sequence> + <xsd:element name="a" type="type"/> + <xsd:element ref="b"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="root" type="root_t"/> + +</xsd:schema> diff --git a/xsd-tests/cxx/tree/chameleon/includer.xsd b/xsd-tests/cxx/tree/chameleon/includer.xsd new file mode 100644 index 0000000..a1c850a --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/includer.xsd @@ -0,0 +1,12 @@ +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns="test" targetNamespace="test"> + + <xsd:include schemaLocation="includee.xsd"/> + + <xsd:simpleType name="type"> + <xsd:restriction base="xsd:string"/> + </xsd:simpleType> + + <xsd:element name="b" type="xsd:string"/> + +</xsd:schema> diff --git a/xsd-tests/cxx/tree/chameleon/output b/xsd-tests/cxx/tree/chameleon/output new file mode 100644 index 0000000..c40f715 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/output @@ -0,0 +1,3 @@ + +a: a +b: b diff --git a/xsd-tests/cxx/tree/chameleon/test.xml b/xsd-tests/cxx/tree/chameleon/test.xml new file mode 100644 index 0000000..12ff279 --- /dev/null +++ b/xsd-tests/cxx/tree/chameleon/test.xml @@ -0,0 +1,8 @@ +<t:root xmlns:t="test" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="test includer.xsd"> + + <a>a</a> + <t:b>b</t:b> + +</t:root> |