From 5e527213a2430bb3018e5eebd909aef294edf9b5 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- examples/cxx/tree/custom/mixed/driver.cxx | 123 ------------------------------ 1 file changed, 123 deletions(-) delete mode 100644 examples/cxx/tree/custom/mixed/driver.cxx (limited to 'examples/cxx/tree/custom/mixed/driver.cxx') diff --git a/examples/cxx/tree/custom/mixed/driver.cxx b/examples/cxx/tree/custom/mixed/driver.cxx deleted file mode 100644 index 0378f18..0000000 --- a/examples/cxx/tree/custom/mixed/driver.cxx +++ /dev/null @@ -1,123 +0,0 @@ -// file : examples/cxx/tree/custom/mixed/driver.cxx -// copyright : not copyrighted - public domain - -#include // std::auto_ptr -#include - -#include -#include - -#include "people.hxx" - -// The following transcode() utility function is handy when working with -// Xerces. Include it after the generated header in order to get only char -// or wchar_t version depending on how you compiled your schemas. -// -#include - -using std::cerr; -using std::endl; -using namespace xercesc; - - -void -xhtml2txt (const DOMElement*); - -int -main (int argc, char* argv[]) -{ - if (argc != 2) - { - cerr << "usage: " << argv[0] << " people.xml" << endl; - return 1; - } - - int r (0); - - // The Xerces-C++ DOM document that will be used to store the XHTML - // fragments "out-live" the call to the parsing function. Therefore - // we need to initialize the Xerces-C++ runtime ourselves. - // - XMLPlatformUtils::Initialize (); - - try - { - using namespace people; - - // Parse. - // - std::auto_ptr d ( - directory_ (argv[1], xml_schema::flags::dont_initialize)); - - // Print what we've got. - // - const directory::person_sequence& s (d->person ()); - - for (directory::person_const_iterator i (s.begin ()); i != s.end (); ++i) - { - cerr << "First : " << i->first_name () << endl - << "Last : " << i->last_name () << endl - << "Gender : " << i->gender () << endl - << "Age : " << i->age () << endl; - - const bio& b (i->bio ()); - const DOMElement* xhtml (b.xhtml ()); - - if (xhtml != 0) - { - cerr << "Bio : " << endl; - xhtml2txt (xhtml); - } - - cerr << endl; - } - - // Serialize. - // - xml_schema::namespace_infomap map; - - map["ppl"].name = "http://www.codesynthesis.com/people"; - map["ppl"].schema = "people.xsd"; - - directory_ ( - std::cout, *d, map, "UTF-8", xml_schema::flags::dont_initialize); - } - catch (const xml_schema::exception& e) - { - cerr << e << endl; - r = 1; - } - - XMLPlatformUtils::Terminate (); - return r; -} - -// Primitive XHTML to text converter that just prints all the text -// nodes and ignores everything else. -// -void -xhtml2txt (const DOMElement* e) -{ - namespace xml = xsd::cxx::xml; - - for (const DOMNode* n (e->getFirstChild ()); - n != 0; - n = n->getNextSibling ()) - { - switch (n->getNodeType ()) - { - case DOMNode::TEXT_NODE: - { - cerr << xml::transcode (n->getTextContent ()); - break; - } - case DOMNode::ELEMENT_NODE: - { - xhtml2txt (static_cast (n)); - break; - } - default: - break; // Ignore all other nodes (e.g., comments, etc). - } - } -} -- cgit v1.1