Advertisement
fili

XSDe simple example

Nov 29th, 2013
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. std::string file = "my.xml";
  2. try
  3. {
  4.     myns::root_paggr root_p;
  5.     xml_schema::document_pimpl doc_p (root_p.root_parser (), root_p.root_name(), true);
  6.     root_p.pre();
  7.     doc_p.parse(file);
  8.     std::auto_ptr<myns::root> root (root_p.post());
  9.  
  10.     myns::root::type_sequence& ts = root->type();
  11.     for (myns::root::type_iterator i = ts.begin(); i != ts.end(); ++i)
  12.     {
  13.       myns::type& t = *i;
  14.       std::cout << t.id() << std::endl;
  15.     }
  16. }
  17. catch (const xml_schema::parser_exception& e)
  18. {
  19.     std::cerr << file << ":" << e.line() << ":" << e.column() << ":" << e.text() << std::endl;
  20. }
  21. catch(const xml_schema::serializer_exception& e)
  22. {
  23.     std::cerr << "error: " << e.text() << std::endl;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement