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
47namespace XALAN_CPP_NAMESPACE {
48
49
50
51
52
53class XalanAttr;
54class XalanDocument;
55
58
59
61{
62public:
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*
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
108
109 virtual bool
110 endNode(const XalanNode* node);
111
112 virtual bool
114
115 private:
116
117 NamespacesMapType& m_map;
118 };
119
120
121protected:
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
134private:
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
#define XALAN_DOMSUPPORT_EXPORT
#define XALAN_DEFAULT_MEMMGR
#define XALAN_USES_MEMORY_MANAGER(Type)
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
This class defines an interface for classes that resolve namespace prefixes to their URIs.
A utility class to walk the XalanDocument instance and look for attribute nodes that declare namespac...
virtual bool endNode(const XalanNode *node)
Called when leaving a node.
virtual bool startNode(const XalanNode *node)
Called when first walking a node.
virtual bool startNode(XalanNode *node)
Called when first walking a node.
virtual bool endNode(XalanNode *node)
Called when leaving a node.
virtual const XalanDOMString * duplicateBinding(const AttributeVectorType &theVector) const
This function is called when more than one binding exists for a given prefix.
XalanDocumentPrefixResolver(const XalanDocument *theDocument, const XalanDOMString &theURI=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
Constructor.
XalanMap< const XalanDOMString *, AttributeVectorType > NamespacesMapType
virtual const XalanDOMString & getURI() const
Retrieve the base URI for the resolver.
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve a namespace corresponding to a prefix.
Xalan implementation of a hashtable.
Definition XalanMap.hpp:187