14c1d703cf7e8f94be3912e98cb3caef68fb236d
[SXSI/xpathcomp.git] / SXSIStorageInterface.cpp
1 /*******************************************
2  * SXSIStorageInterface.cpp
3  * ------------------------
4  *
5  * 
6  * Author: Kim Nguyen
7  * Date: 04/11/08
8  */
9
10
11 #include "SXSIStorageInterface.h"
12 #include "Utils.h"
13
14
15 SXSIStorageInterface::SXSIStorageInterface()
16 {
17   tree = new XMLTree();
18   tree->OpenDocument(true,1);
19 }
20
21 SXSIStorageInterface::~SXSIStorageInterface()
22 {
23 }
24
25 void SXSIStorageInterface::newChild(string name)
26
27   cerr << "New child " << name << "\n";
28   tree->NewOpenTag((unsigned char*) name.c_str());
29 }
30
31
32 void SXSIStorageInterface::newText(string text)
33 {
34   if (text.empty()){
35     cerr << "Calling newEmptyText()\n";
36     tree->NewEmptyText();
37   }
38   else {
39     cerr << "Calling newText(" << text <<")\n";
40     tree->NewText((unsigned char*) text.c_str());
41     
42   };
43 }
44         
45
46
47 void SXSIStorageInterface::nodeFinished(string name)
48 {  
49     cerr << "Node Finished child " << name << "\n";
50    tree->NewClosingTag((unsigned char*) name.c_str());
51  }            
52               
53   void SXSIStorageInterface::parsingFinished()
54 {
55    tree->CloseDocument();
56         
57 }
58
59 void *SXSIStorageInterface::returnDocument(){
60
61   return ((void *) tree);
62   
63 }