diff options
Diffstat (limited to 'xsd/examples/cxx/tree/hello/driver.cxx')
-rw-r--r-- | xsd/examples/cxx/tree/hello/driver.cxx | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/xsd/examples/cxx/tree/hello/driver.cxx b/xsd/examples/cxx/tree/hello/driver.cxx new file mode 100644 index 0000000..b6629b3 --- /dev/null +++ b/xsd/examples/cxx/tree/hello/driver.cxx @@ -0,0 +1,36 @@ +// file : examples/cxx/tree/hello/driver.cxx +// copyright : not copyrighted - public domain + +#include <memory> // std::auto_ptr +#include <iostream> + +#include "hello.hxx" + +using namespace std; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " hello.xml" << endl; + return 1; + } + + try + { + auto_ptr<hello_t> h (hello (argv[1])); + + for (hello_t::name_const_iterator i (h->name ().begin ()); + i != h->name ().end (); + ++i) + { + cout << h->greeting () << ", " << *i << "!" << endl; + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} |