diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-11 09:30:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-03-11 09:30:41 +0200 |
commit | 9db750f407ceeb5c1fab99414b074d289bfda179 (patch) | |
tree | eb1a5e52ebf84d79d378d5ab2ae56372028776e0 /tests/cxx/hybrid/recursive/driver.cxx | |
parent | bc628cff98a1d90d4ee293f22979db56b4ed0695 (diff) |
Add support for parsing/serialization of recursive types
tests/cxx/hybrid/recursive/: new test
Diffstat (limited to 'tests/cxx/hybrid/recursive/driver.cxx')
-rw-r--r-- | tests/cxx/hybrid/recursive/driver.cxx | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/cxx/hybrid/recursive/driver.cxx b/tests/cxx/hybrid/recursive/driver.cxx new file mode 100644 index 0000000..d3ce1c3 --- /dev/null +++ b/tests/cxx/hybrid/recursive/driver.cxx @@ -0,0 +1,56 @@ +// file : tests/cxx/hybrid/recursive/driver.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2006-2009 Code Synthesis Tools CC +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test recursive parsing and serialization. +// + +#include <iostream> + +#include "test.hxx" +#include "test-pimpl.hxx" +#include "test-simpl.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; + } + + // Parse. + // + root_paggr root_p; + + xml_schema::document_pimpl doc_p ( + root_p.root_parser (), + root_p.root_namespace (), + root_p.root_name ()); + + root_p.pre (); + doc_p.parse (argv[1]); + type* r = root_p.post (); + + // Serialize. + // + root_saggr root_s; + + xml_schema::document_simpl doc_s ( + root_s.root_serializer (), + root_s.root_namespace (), + root_s.root_name ()); + + doc_s.add_prefix ("t", "test"); + + root_s.pre (*r); + doc_s.serialize (cout); + root_s.post (); + + delete r; +} |