X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=SXSIStorageInterface.cpp;h=2594bd2595aab552d37845d02c1612cfff2ba3fc;hb=04639fe524ee20f7f84c8b08387312d714c9bd56;hp=14c1d703cf7e8f94be3912e98cb3caef68fb236d;hpb=9be0c0e2a5597148fdc3a3cca2bdaf69da0aa27d;p=SXSI%2Fxpathcomp.git diff --git a/SXSIStorageInterface.cpp b/SXSIStorageInterface.cpp index 14c1d70..2594bd2 100644 --- a/SXSIStorageInterface.cpp +++ b/SXSIStorageInterface.cpp @@ -11,11 +11,11 @@ #include "SXSIStorageInterface.h" #include "Utils.h" - -SXSIStorageInterface::SXSIStorageInterface() +SXSIStorageInterface::SXSIStorageInterface(int sf,bool iet,bool dtc) { - tree = new XMLTree(); - tree->OpenDocument(true,1); + tree = NULL; + tb = new XMLTreeBuilder(); + tb ->OpenDocument(iet,sf,dtc); } SXSIStorageInterface::~SXSIStorageInterface() @@ -24,40 +24,43 @@ SXSIStorageInterface::~SXSIStorageInterface() void SXSIStorageInterface::newChild(string name) { - cerr << "New child " << name << "\n"; - tree->NewOpenTag((unsigned char*) name.c_str()); + tb->NewOpenTag(name); } void SXSIStorageInterface::newText(string text) { - if (text.empty()){ - cerr << "Calling newEmptyText()\n"; - tree->NewEmptyText(); - } - else { - cerr << "Calling newText(" << text <<")\n"; - tree->NewText((unsigned char*) text.c_str()); - - }; + + tb->NewText(text); } - void SXSIStorageInterface::nodeFinished(string name) { - cerr << "Node Finished child " << name << "\n"; - tree->NewClosingTag((unsigned char*) name.c_str()); - } + tb->NewClosingTag(name); + +} void SXSIStorageInterface::parsingFinished() { - tree->CloseDocument(); + + tree = tb->CloseDocument(); } void *SXSIStorageInterface::returnDocument(){ - +#ifdef DEBUG + printStats(); +#endif return ((void *) tree); } + +void SXSIStorageInterface::printStats(){ + std::cerr << "Parsing stats : \n"; + std::cerr << _new_child << " calls to newOpenTag/newClosingTag\n"; + std::cerr << _new_text << " calls to newText\n"; + std::cerr << _new_empty_text << " calls to newEmptyText\n"; + std::cerr << _length_text << " bytes (=" << _length_text/1024 << "kb ) added to TextCollection\n"; + return; +}