21int main(
int argc,
char* argv[] ) {
22 XERCES_CPP_NAMESPACE_USE
25 if ( argc < 2 ) { infile = std::string(
"$(XMLBASEROOT)/xml/test.xml" ); }
26 else { infile = std::string( argv[1] ); }
36 std::cout <<
"caught exception with message " << std::endl;
37 std::cout << ex.
getMsg() << std::endl;
44 std::cout <<
"Document successfully parsed" << std::endl;
47 DOMElement* docElt = doc->getDocumentElement();
55 std::cout <<
"goodInt value was " << intVal << std::endl << std::endl;
57 { std::cout << std::endl <<
"DomException: " << ex.
getMsg() << std::endl << std::endl; }
61 std::vector<int> ints;
63 std::cout <<
"Found " << nInts <<
" goodInts: " << std::endl;
64 for (
unsigned iInt = 0; iInt < nInts; iInt++ ) { std::cout << ints[iInt] <<
" "; }
65 std::cout << std::endl << std::endl;
68 std::cout << std::endl
69 <<
"DomException processing goodInts: " << ex.
getMsg() << std::endl
75 std::vector<double> doubles;
77 std::cout <<
"Found " << nD <<
" goodDoubles: " << std::endl;
78 for (
unsigned iD = 0; iD < nD; iD++ ) { std::cout << doubles[iD] <<
" "; }
79 std::cout << std::endl << std::endl;
82 std::cout << std::endl
83 <<
"DomException processing goodDoubles: " << ex.
getMsg() << std::endl
90 std::cout <<
"badInt value was " << intVal << std::endl << std::endl;
92 { std::cout << std::endl <<
"DomException: " << ex.
getMsg() << std::endl << std::endl; }
97 std::cout <<
"goodDouble value was " << doubleVal << std::endl << std::endl;
99 { std::cout << std::endl <<
"DomException: " << ex.
getMsg() << std::endl << std::endl; }
104 std::cout << std::endl <<
"badDouble value was " << doubleVal << std::endl << std::endl;
106 { std::cout << std::endl <<
"DomException: " << ex.
getMsg() << std::endl << std::endl; }
110 std::vector<double> doubles;
112 std::cout <<
"Found " << nD <<
" badDoubles: " << std::endl;
113 for (
unsigned iD = 0; iD < nD; iD++ ) { std::cout << doubles[iD] <<
" "; }
114 std::cout << std::endl << std::endl;
117 std::cout << std::endl
118 <<
"DomException processing badDoubles: " << ex.
getMsg() << std::endl
128 if ( *( argv[2] ) == *hyphen ) { out = &std::cout; }
131 char* filename = argv[2];
132 out =
new std::ofstream( filename );
134 *out <<
"Document source: " << std::string( argv[1] ) << std::endl;
135 *out << std::endl <<
"Straight print of document:" << std::endl;
137 *out << std::endl << std::endl <<
"Add indentation and line breaks:" << std::endl;