test_xsd_hello.cxx string iostream hello-pskel.hxx hello_pimpl int int main (int argc, char *argv[]) main int argc char * argv [] //file:examples/cxx/parser/hello/driver.cxx //author:BorisKolpackov<boris@codesynthesis.com> //copyright:notcopyrighted-publicdomain #include<string> #include<iostream> #include"hello-pskel.hxx" usingnamespacestd; structhello_pimpl:hello_pskel { virtualvoid greeting(conststring&greeting) { greeting_=greeting; } virtualvoid name(conststring&name) { cout<<greeting_<<","<<name<<"!"<<endl; } private: stringgreeting_; }; int main(intargc,char*argv[]) { if(argc!=2) { cerr<<"usage:"<<argv[0]<<"hello.xml"<<endl; return1; } try { //Constructtheparser. // xml_schema::string_pimplstring_p; hello_pimplhello_p; hello_p.greeting_parser(string_p); hello_p.name_parser(string_p); //ParsetheXMLinstancedocument.Thesecondargumenttothe //document'sconstructoristhedocument'srootelementname. // xml_schema::documentdoc_p(hello_p,"hello"); hello_p.pre(); doc_p.parse(argv[1]); hello_p.post_hello(); } catch(constxml_schema::exception&e) { cerr<<e<<endl; return1; } catch(conststd::ios_base::failure&) { cerr<<argv[1]<<":unabletoopenorreadfailure"<<endl; return1; } }