SourceForge.net Logo
NSFixupFilter.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001, 2008,
3  * DecisionSoft Limited. All rights reserved.
4  * Copyright (c) 2004, 2015 Oracle and/or its affiliates. All rights reserved.
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef _NSFIXUPFILTER_HPP
21 #define _NSFIXUPFILTER_HPP
22 
24 
26 
27 class XQILLA_API NSFixupFilter : public EventFilter
28 {
29 public:
31  ~NSFixupFilter();
32 
33  virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding);
34  virtual void endDocumentEvent();
35  virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname);
36  virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname,
37  const XMLCh *typeURI, const XMLCh *typeName);
38  virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value,
39  const XMLCh *typeURI, const XMLCh *typeName);
40  virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri);
41 
42 private:
43  struct ElemEntry {
44  void set(const XMLCh *p, ElemEntry *pr)
45  { prefix = p; prev = pr; }
46 
47  const XMLCh *prefix;
48  ElemEntry *prev;
49  };
50 
51  struct NSEntry {
52  void set(const XMLCh *p, const XMLCh *u, unsigned int l, NSEntry *pr)
53  { prefix = p; uri = u; level = l; prev = pr; }
54 
55  const XMLCh *prefix;
56  const XMLCh *uri;
57  unsigned int level;
58 
59  NSEntry *prev;
60  };
61 
62  NSEntry *findPrefix(const XMLCh *prefix);
64  bool definePrefix(const XMLCh *&prefix, const XMLCh *uri, bool attr = false, bool redefine = true);
65 
67  unsigned int level_;
68  ElemEntry *elements_;
69  NSEntry *namespaces_;
70 };
71 
72 #endif
Definition: EventHandler.hpp:67
Definition: XPath2MemoryManager.hpp:45
virtual void startElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname)
Handles the start of an element node as an event.
Definition: EventHandler.hpp:95
Definition: EventHandler.hpp:29
virtual void endDocumentEvent()
Handles a document node as an event.
Definition: EventHandler.hpp:90
virtual void namespaceEvent(const XMLCh *prefix, const XMLCh *uri)
Handles a namespace binding as an event.
Definition: EventHandler.hpp:132
virtual void startDocumentEvent(const XMLCh *documentURI, const XMLCh *encoding)
Handles a document node as an event.
Definition: EventHandler.hpp:85
virtual void attributeEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *value, const XMLCh *typeURI, const XMLCh *typeName)
Handles an attribute node as an event.
Definition: EventHandler.hpp:126
virtual void endElementEvent(const XMLCh *prefix, const XMLCh *uri, const XMLCh *localname, const XMLCh *typeURI, const XMLCh *typeName)
Handles the end of an element node as an event.
Definition: EventHandler.hpp:100
Definition: NSFixupFilter.hpp:27