From a8ce5c380c69539fe0c7c62c397634d9d0c9fde2 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- libxsd-tests/cxx/tree/basic/buildfile | 7 ++++ libxsd-tests/cxx/tree/basic/driver.cxx | 65 ++++++++++++++++++++++++++++++ libxsd-tests/cxx/tree/basic/testscript | 73 ++++++++++++++++++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 libxsd-tests/cxx/tree/basic/buildfile create mode 100644 libxsd-tests/cxx/tree/basic/driver.cxx create mode 100644 libxsd-tests/cxx/tree/basic/testscript (limited to 'libxsd-tests/cxx/tree/basic') diff --git a/libxsd-tests/cxx/tree/basic/buildfile b/libxsd-tests/cxx/tree/basic/buildfile new file mode 100644 index 0000000..1bf94b0 --- /dev/null +++ b/libxsd-tests/cxx/tree/basic/buildfile @@ -0,0 +1,7 @@ +# file : cxx/tree/basic/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}{*} $libs testscript diff --git a/libxsd-tests/cxx/tree/basic/driver.cxx b/libxsd-tests/cxx/tree/basic/driver.cxx new file mode 100644 index 0000000..d36d31e --- /dev/null +++ b/libxsd-tests/cxx/tree/basic/driver.cxx @@ -0,0 +1,65 @@ +// file : cxx/tree/basic/driver.cxx +// copyright : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include +#include + +#include +#include +#include + +// Define XSD_CXX11 since we include libxsd headers directly. +// +#ifdef _MSC_VER +# if _MSC_VER >= 1600 // VC++10 and later have C++11 always enabled. +# define XSD_CXX11 +# endif +#else +# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +# define XSD_CXX11 +# endif +#endif + +#include + +#include // XSD_DOM_AUTO_PTR +#include // name() +#include // parser, parse() + +#include // text_content() +#include +#include // auto_initializer, properties +#include // parsing +#include + +using namespace std; +using namespace xsd::cxx; + +// Usage: argv[0] +// +// Parse the specified XML file using the XML DOM parser and print the element +// names and values to stdout. +// +int +main (int argc, char* argv[]) +{ + assert (argc == 2); + + xml::auto_initializer ai; + + tree::error_handler h; + tree::properties ps; + + XSD_DOM_AUTO_PTR d ( + xml::dom::parse (argv[1], h, ps, 0 /* flags */)); + + h.throw_if_failed> (); // Abort on error. + + xml::dom::parser p (*d->getDocumentElement (), true, false, false); + for (; p.more_content (); p.next_content (false /* text */)) + { + const xercesc::DOMElement& i (p.cur_element ()); + const xml::qualified_name n (xml::dom::name (i)); + cout << n.name () << ' ' << tree::text_content (i) << endl; + } +} diff --git a/libxsd-tests/cxx/tree/basic/testscript b/libxsd-tests/cxx/tree/basic/testscript new file mode 100644 index 0000000..2606688 --- /dev/null +++ b/libxsd-tests/cxx/tree/basic/testscript @@ -0,0 +1,73 @@ +# file : cxx/tree/basic/testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +: basic +: +{ + cat <=hello.xsd; + + + + + + + + The hello_t type consists of a greeting phrase and a + collection of names to which this greeting applies. + + + + + + + + + The greeting element contains the greeting phrase + for this hello object. + + + + + + + + The name elements contains names to be greeted. + + + + + + + + + + + The hello element is a root of the Hello XML vocabulary. + Every conforming document should start with this element. + + + + + EOI + + cat <=hello.xml; + + + + Hello + + sun + moon + world + + + EOI + + $* hello.xml >>EOO + greeting Hello + name sun + name moon + name world + EOO +} -- cgit v1.1