00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _QUERYPATHTREEFILTER_HPP
00021 #define _QUERYPATHTREEFILTER_HPP
00022
00023 #include <vector>
00024
00025 #include <xqilla/events/EventHandler.hpp>
00026
00027 #include <xercesc/framework/XMLBuffer.hpp>
00028
00029 class QueryPathNode;
00030 typedef std::vector<const QueryPathNode *> QPNVector;
00031
00032 class XQILLA_API QueryPathTreeFilter : public EventFilter
00033 {
00034 public:
00035 QueryPathTreeFilter(const QueryPathNode *qpn, EventHandler *next);
00036 QueryPathTreeFilter(const QPNVector &qpns, EventHandler *next);
00037 virtual ~QueryPathTreeFilter();
00038
00039 virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding);
00040 virtual void endDocumentEvent();
00041 virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname);
00042 virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
00043 const XMLCh *typeURI, const XMLCh *typeName);
00044 virtual void piEvent(const XMLCh *target, const XMLCh *value);
00045 virtual void textEvent(const XMLCh *value);
00046 virtual void textEvent(const XMLCh *chars, unsigned int length);
00047 virtual void commentEvent(const XMLCh *value);
00048 virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
00049 const XMLCh *typeURI, const XMLCh *typeName);
00050 virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri);
00051
00052 protected:
00053 struct StackEntry {
00054 StackEntry() : matched(false), nonElementChildren(false), attrChildren(false), children() {}
00055
00056 void addNode(const QueryPathNode *isn);
00057 void addChildren(const QueryPathNode *isn);
00058
00059 XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer prefix;
00060 XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer uri;
00061 XERCES_CPP_NAMESPACE_QUALIFIER XMLBuffer localname;
00062
00063 bool matched;
00064
00065 bool nonElementChildren;
00066 bool attrChildren;
00067 QPNVector children;
00068 };
00069
00070 typedef std::vector<StackEntry*> FilterStack;
00071
00072 void checkAncestors(FilterStack::reverse_iterator s);
00073
00074 FilterStack stack_;
00075 };
00076
00077 #endif