Xalan-C++ API Reference  1.12.0
XalanDocumentPrefixResolver.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XALANDOCUMENTPREFIXRESOLVER_HEADER_GUARD_1357924680)
19 #define XALANDOCUMENTPREFIXRESOLVER_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
29 
30 
31 
34 
35 
36 
40 
41 
42 
44 
45 
46 
47 namespace XALAN_CPP_NAMESPACE {
48 
49 
50 
51 
52 
53 class XalanAttr;
55 
58 
59 
61 {
62 public:
63 
65  typedef XalanMap<const XalanDOMString*,
67 
68  /**
69  * Constructor.
70  *
71  * @param theDocument The XalanDocument instance to use for namespace bindings.
72  * @param theURI The base URI for the instance. This is rarely needed, but can be provided if the URI for the XalanDocument instance is known.
73  */
75  const XalanDocument* theDocument,
76  const XalanDOMString& theURI = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
77  MemoryManager& theManager XALAN_DEFAULT_MEMMGR);
78 
79  virtual
81 
82 
83  virtual const XalanDOMString*
84  getNamespaceForPrefix(const XalanDOMString& prefix) const;
85 
86  virtual const XalanDOMString&
87  getURI() const;
88 
89  /**
90  * A utility class to walk the XalanDocument instance and look for attribute nodes that declare namespaces.
91  */
93  {
94  public:
95 
97 
98  virtual
100 
101  protected:
102 
103  virtual bool
104  startNode(const XalanNode* node);
105 
106  virtual bool
107  startNode(XalanNode* node);
108 
109  virtual bool
110  endNode(const XalanNode* node);
111 
112  virtual bool
113  endNode(XalanNode* node);
114 
115  private:
116 
117  NamespacesMapType& m_map;
118  };
119 
120 
121 protected:
122 
123  /**
124  * This function is called when more than one binding exists for a given prefix.
125  * The default behavior uses the first binding, but a deriving class can change
126  * that behavior by overriding.
127  *
128  * @param theVector The vector associated with the namespace prefix.
129  * @return A pointer to a const XalanDOMString containing the desired binding, or NULL.
130  */
131  virtual const XalanDOMString*
132  duplicateBinding(const AttributeVectorType& theVector) const;
133 
134 private:
135 
136  NamespacesMapType m_namespaces;
137 
138  const XalanDOMString m_uri;
139 };
140 
141 
142 
143 }
144 
145 
146 
147 #endif // XALANDOCUMENTPREFIXRESOLVER_HEADER_GUARD_1357924680
XALAN_DOMSUPPORT_EXPORT
#define XALAN_DOMSUPPORT_EXPORT
Definition: DOMSupportDefinitions.hpp:35
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
PrefixResolver.hpp
xalanc::XalanNode
Definition: XalanNode.hpp:38
XalanDOMString.hpp
xalanc::XalanVector< const XalanNode * >
XALAN_USES_MEMORY_MANAGER
#define XALAN_USES_MEMORY_MANAGER(Type)
Definition: XalanMemoryManagement.hpp:589
xalanc::XalanDocumentPrefixResolver
Definition: XalanDocumentPrefixResolver.hpp:60
xalanc::XalanDocument
Definition: XalanDocument.hpp:36
XALAN_DEFAULT_MEMMGR
#define XALAN_DEFAULT_MEMMGR
Definition: XalanMemoryManagement.hpp:516
xalanc::XalanDocumentPrefixResolver::NamespaceNodesTreeWalker
A utility class to walk the XalanDocument instance and look for attribute nodes that declare namespac...
Definition: XalanDocumentPrefixResolver.hpp:92
XalanVector.hpp
xalanc::XalanDocumentPrefixResolver::AttributeVectorType
AttributeVectorTypeDecl AttributeVectorType
Definition: XalanDocumentPrefixResolver.hpp:64
STLHelper.hpp
DOMStringHelper.hpp
xalanc::XalanDocumentPrefixResolver::NamespacesMapType
XalanMap< const XalanDOMString *, AttributeVectorType > NamespacesMapType
Definition: XalanDocumentPrefixResolver.hpp:66
xalanc::PrefixResolver
This class defines an interface for classes that resolve namespace prefixes to their URIs.
Definition: PrefixResolver.hpp:39
xalanc::XalanMap
Xalan implementation of a hashtable.
Definition: XalanMap.hpp:186
TreeWalker.hpp
XalanMap.hpp
DOMSupportDefinitions.hpp
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45
xalanc::AttributeVectorTypeDecl
XalanVector< const XalanNode * > AttributeVectorTypeDecl
Definition: XalanDocumentPrefixResolver.hpp:54
xalanc::TreeWalker
Definition: TreeWalker.hpp:36