1 #include "XMLDocShredder.h"
6 void print_structure(XMLTree* tree, treeNode x){
9 std::cout << "Par idx: " << x << ", preorder: " <<
10 tree->NodeXMLId(x) << ", tag='" << tree->GetTagName(tree->Tag(x))
12 text = tree->PrevText(x);
13 std::cout << "PrevText(" << x << ")= " << text
14 << ", value='" << ((text == NULLT) ? "" : (const char*)tree->GetText(text))
16 text = tree->MyText(x);
17 std::cout << "MyText(" << x << ")= " << text
18 << ", value='" << ((text == NULLT) ? "" : (const char*)tree->GetText(text))
20 text = tree->NextText(x);
21 std::cout << "NextText(" << x << ")= " << text
22 << ", value='" << ((text == NULLT) ? "" : (const char*)tree->GetText(text))
24 print_structure(tree,tree->FirstChild(x));
25 print_structure(tree,tree->NextSibling(x));
29 int main(int argc, char** argv){
32 std::cout << "Usage " << argv[0] << " filename.xml" << std::endl;
36 XMLDocShredder shredder(argv[1],64,false,false);
37 shredder.processStartDocument("");
39 shredder.processEndDocument();
40 tree = (XMLTree *) shredder.storageIfc_->returnDocument();
41 print_structure(tree,tree->Root());