21int main(
int argc,
char* argv[]) {
22 XERCES_CPP_NAMESPACE_USE
26 infile=std::string(
"$(XMLBASEROOT)/xml/test.xml");
29 infile = std::string(argv[1]);
38 doc = parser->
parse(infile.c_str());
41 std::cout <<
"caught exception with message " << std::endl;
42 std::cout << ex.
getMsg() << std::endl;
48 std::cout <<
"Document successfully parsed" << std::endl;
51 DOMElement* docElt = doc->getDocumentElement();
59 std::cout <<
"goodInt value was " << intVal << std::endl << std::endl;
62 std::cout << std::endl <<
"DomException: " << ex.
getMsg()
63 << std::endl << std::endl;
67 std::vector<int> ints;
69 std::cout <<
"Found " << nInts <<
" goodInts: " << std::endl;
70 for (
unsigned iInt=0; iInt < nInts; iInt++) {
71 std::cout << ints[iInt] <<
" ";
73 std::cout << std::endl << std::endl;
76 std::cout << std::endl <<
"DomException processing goodInts: "
77 << ex.
getMsg() << std::endl << std::endl;
81 std::vector<double> doubles;
84 std::cout <<
"Found " << nD <<
" goodDoubles: " << std::endl;
85 for (
unsigned iD=0; iD < nD; iD++) {
86 std::cout << doubles[iD] <<
" ";
88 std::cout << std::endl << std::endl;
91 std::cout << std::endl <<
"DomException processing goodDoubles: "
92 << ex.
getMsg() << std::endl << std::endl;
99 std::cout <<
"badInt value was " << intVal << std::endl << std::endl;
102 std::cout << std::endl <<
"DomException: " << ex.
getMsg()
103 << std::endl << std::endl;
108 std::cout <<
"goodDouble value was " << doubleVal
109 << std::endl << std::endl;
112 std::cout << std::endl <<
"DomException: " << ex.
getMsg()
113 << std::endl << std::endl;
118 std::cout << std::endl <<
"badDouble value was " << doubleVal
119 << std::endl << std::endl;
122 std::cout << std::endl <<
"DomException: " << ex.
getMsg()
123 << std::endl << std::endl;
128 std::vector<double> doubles;
131 std::cout <<
"Found " << nD <<
" badDoubles: " << std::endl;
132 for (
unsigned iD=0; iD < nD; iD++) {
133 std::cout << doubles[iD] <<
" ";
135 std::cout << std::endl << std::endl;
138 std::cout << std::endl <<
"DomException processing badDoubles: "
140 << std::endl << std::endl;
148 if (*(argv[2]) == *hyphen) {
152 char *filename = argv[2];
153 out =
new std::ofstream(filename);
155 *out <<
"Document source: " << std::string(argv[1]) << std::endl;
156 *out << std::endl <<
"Straight print of document:" << std::endl;
158 *out << std::endl << std::endl <<
"Add indentation and line breaks:"