summaryrefslogtreecommitdiff
path: root/tests/cxx/tree/order/driver.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cxx/tree/order/driver.cxx')
-rw-r--r--tests/cxx/tree/order/driver.cxx65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/cxx/tree/order/driver.cxx b/tests/cxx/tree/order/driver.cxx
new file mode 100644
index 0000000..01d8d9f
--- /dev/null
+++ b/tests/cxx/tree/order/driver.cxx
@@ -0,0 +1,65 @@
+// file : tests/cxx/tree/order/driver.cxx
+// copyright : Copyright (c) 2006-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+// Test ordered type support.
+//
+
+#include <memory> // std::auto_ptr/unique_ptr
+#include <cassert>
+#include <iostream>
+
+#include <xercesc/dom/DOM.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+
+#include "test.hxx"
+
+using namespace std;
+using namespace test;
+using namespace xercesc;
+
+int
+main (int argc, char* argv[])
+{
+ if (argc != 2)
+ {
+ cerr << "usage: " << argv[0] << " test.xml" << endl;
+ return 1;
+ }
+
+ XMLPlatformUtils::Initialize ();
+
+ try
+ {
+ XSD_AUTO_PTR<root> r (root_ (argv[1], xml_schema::flags::dont_initialize));
+
+ root c (*r);
+ assert (c == *r);
+
+ for (root::t1_const_iterator j (r->t1 ().begin ());
+ j != r->t1 ().end (); ++j)
+ {
+ const t1_derived& d (*j);
+
+ for (t1_derived::content_order_const_iterator i (
+ d.content_order ().begin ()); i != d.content_order ().end (); ++i)
+ {
+ cout << i->id << ' ' << i->index << endl;
+ }
+ }
+
+ xml_schema::namespace_infomap map;
+
+ map["t"].name = "test";
+ map["t1"].name = "test1";
+
+ root_ (cout, *r, map, "UTF-8", xml_schema::flags::dont_initialize);
+ }
+ catch (xml_schema::exception const& e)
+ {
+ cerr << e << endl;
+ return 1;
+ }
+
+ XMLPlatformUtils::Terminate ();
+}