From f0510d2f90467de8e8f260b47d79a9baaf9bef17 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 17 Sep 2009 07:15:29 +0200 Subject: Start tracking XSD with git --- examples/cxx/tree/custom/contacts/driver.cxx | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 examples/cxx/tree/custom/contacts/driver.cxx (limited to 'examples/cxx/tree/custom/contacts/driver.cxx') diff --git a/examples/cxx/tree/custom/contacts/driver.cxx b/examples/cxx/tree/custom/contacts/driver.cxx new file mode 100644 index 0000000..9015e87 --- /dev/null +++ b/examples/cxx/tree/custom/contacts/driver.cxx @@ -0,0 +1,39 @@ +// file : examples/cxx/tree/custom/contacts/driver.cxx +// author : Boris Kolpackov +// copyright : not copyrighted - public domain + +#include // std::auto_ptr +#include + +#include "contacts.hxx" + +using std::cerr; +using std::endl; + +int +main (int argc, char* argv[]) +{ + if (argc != 2) + { + cerr << "usage: " << argv[0] << " contacts.xml" << endl; + return 1; + } + + try + { + using namespace contacts; + + std::auto_ptr c (catalog_ (argv[1])); + + for (catalog::contact_const_iterator i (c->contact ().begin ()); + i != c->contact ().end (); ++i) + { + i->print (cerr); + } + } + catch (const xml_schema::exception& e) + { + cerr << e << endl; + return 1; + } +} -- cgit v1.1