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