removed cruft, fixed ptset.ml
[SXSI/xpathcomp.git] / XMLDocShredder.h
1 /**************************************
2  * XMLDocShredder.h
3  * --------------------
4  * Header file for the shredder routine that invokes the XML parser and 
5  * calls the appropriate construction methods of the storage interface in
6  * correspondence with received parsing events.
7  * 
8  * Author: Greg Leighton
9  * Date: 02/11/08
10  */
11
12 #ifndef XMLDOCSHREDDER_H_
13 #define XMLDOCSHREDDER_H_
14
15 #include <libxml++/libxml++.h>
16 #include <libxml++/parsers/textreader.h>
17 #include <string>
18 #include "StorageInterface.h"
19
20 using namespace std;
21 using namespace xmlpp;
22
23
24 class XMLDocShredder
25 {
26 public:
27   XMLDocShredder(const string inFileName,int sf, bool iet, bool dtc);
28   XMLDocShredder(const unsigned char * data, TextReader::size_type size,int sf, bool iet, bool dtc);
29   virtual ~XMLDocShredder();
30   virtual void processStartElement();
31   virtual void processEndElement();
32   virtual void processPCDATA();
33   virtual void processAttributes();
34   virtual void processSignificantWhitespace();
35   virtual void processStartDocument(const string docName);
36   virtual void processEndDocument();
37   virtual void processComment();
38   virtual void processProcessingInstruction();
39   virtual void processDocTypeDeclaration();
40   virtual void processUnknownNodeType();
41   virtual void processCDATASection();
42   virtual void parse();
43   
44         StorageInterface *storageIfc_;
45
46         
47 private:
48         TextReader *reader_;
49         void setProperties();
50         bool last_text;
51         string buffer; 
52         // used to coalece successive text events
53         // which can occur if we discard pi and comment nodes.
54 };
55
56 #endif /*XMLDOCSHREDDER_H_*/