Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

doc.h

Go to the documentation of this file.
00001 /* ===========================================================================
00002  *        Filename:  doc.h
00003  *     Description:  Document class
00004  * 
00005  *         Version:  $Rev: 11 $
00006  *         Changed:  $Date: 2005-08-04 17:58:36 -0400 (Do, 04 Aug 2005) $
00007  *         Licence:  GPL (read COPYING file for details)
00008  * 
00009  *          Author:  Erich Schubert (eS), erich@debian.org
00010  *                   Institut für Informatik, LMU München
00011  * ======================================================================== */
00012 #ifndef  SSD_DOC_H
00013 #define  SSD_DOC_H
00014 
00015 #include "config.h"
00016 #include "node.h"
00017 #include "ustring.h"
00018 #include "node_eqclass.h"
00019 #include "util.h"
00020 
00021 #include <vector>
00022 #include <iostream>
00023 #include <map>
00024 #include <set>
00025 
00026 #include <libxml/tree.h>
00027 #include <libxml/xpath.h>
00028 
00029 using namespace std;
00030 using namespace __gnu_cxx;
00031 
00032 namespace SSD {
00033 
00038 class Doc {
00039 protected:
00041         Node*           root;
00043         xmlDocPtr       dom;
00044 
00046         NodeVec         nodes;
00047 
00048         /* process a node in the reader */
00054         void walkTree(Node* pos, xmlNodePtr node);
00059         Node* appendNodeElement(Node* parent, xmlNodePtr node);
00064         Node* appendNodeText(Node* parent, xmlNodePtr node);
00070         Node* appendNodeAttribute(Node* parent, xmlNodePtr node, xmlAttrPtr attr);
00071 
00072 #ifdef NEED_INDEX
00073 
00075         void add_to_index(Node* node);
00076 #endif
00077 #ifdef NEED_PROCESSED_SET
00078 
00083         void add_to_processed(xmlNodePtr node);
00084 #endif
00085         
00092         void walkTreeXPath(xmlXPathContextPtr xpathctx, xmlXPathCompExprPtr xpath, Node* node);
00093 public:
00095         static bool useWhitespace;
00096 #ifdef NEED_INDEX
00097 
00098         NodeEqClassVec  index_by_label;
00099 #endif
00100 #ifdef NEED_PROCESSED_SET
00101 
00102         std::set<void* >        processed;
00103 #endif
00104 
00105         hash_map<xmlNodePtr, Node*, hash<void*> >       xml_to_node;
00107         hash_map<RelEqClass, int, hash_releqc>          relcount;
00108 
00112         bool loadXML(const char* filename);
00115         void processXPath(char* xpath);
00117         Doc();
00119         void flushDoc();
00121         ~Doc();
00123         Node* getRoot() const { return root; }
00126         xmlDocPtr getDOM() const { return dom; }
00128         NodeVec::const_iterator getNodesIter() const { return nodes.begin(); }
00129         NodeVec::const_iterator getNodesIterEnd() const { return nodes.end(); }
00130 };
00131 
00132 }
00133 
00134 #endif   /* ----- #ifndef SSDDOC_H  ----- */

Generated on Thu Aug 4 17:57:12 2005 for SSDDiff by  doxygen 1.4.3-20050530