Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

NamespacesHandler.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #if !defined(XALAN_NAMESPACESHANDLER_HEADER_GUARD)
18 #define XALAN_NAMESPACESHANDLER_HEADER_GUARD
19 
20 
21 
22 // Base include file. Must be first.
24 
25 
26 
29 
30 
31 
33 
34 
35 
38 
39 
40 
41 XALAN_CPP_NAMESPACE_BEGIN
42 
43 
44 
47 
48 
49 
51 {
52 
53 public:
54 
56  {
57  public:
58 
59  PrefixChecker();
60 
61  virtual
62  ~PrefixChecker();
63 
64  virtual bool
65  isActive(const XalanDOMString& thePrefix) const = 0;
66  };
67 
69  {
70  public:
71 
73  m_prefix(&s_emptyString),
74  m_uri(&s_emptyString)
75  {
76  }
77 
79  const XalanDOMString& prefix,
80  const XalanDOMString& uri) :
81  m_prefix(&prefix),
82  m_uri(&uri)
83  {
84  }
85 
91  const XalanDOMString&
92  getPrefix() const
93  {
94  assert(m_prefix != 0);
95 
96  return *m_prefix;
97  }
98 
104  void
105  setPrefix(const XalanDOMString& prefix)
106  {
107  m_prefix = &prefix;
108  }
109 
115  const XalanDOMString&
116  getURI() const
117  {
118  assert(m_uri != 0);
119 
120  return *m_uri;
121  }
122 
128  void
129  setURI(const XalanDOMString& uri)
130  {
131  m_uri = &uri;
132  }
133 
134  protected:
135 
137 
138  private:
139 
140  const XalanDOMString* m_prefix;
141 
142  const XalanDOMString* m_uri;
143  };
144 
146  {
147  public:
148 
150  Namespace(),
151  m_resultAttributeName(&s_emptyString)
152  {
153  }
154 
156  const XalanDOMString& prefix,
157  const XalanDOMString& uri) :
158  Namespace(prefix, uri),
159  m_resultAttributeName(&s_emptyString)
160  {
161  }
162 
168  const XalanDOMString&
170  {
171  assert(m_resultAttributeName != 0);
172 
173  return *m_resultAttributeName;
174  }
175 
181  void
183  {
184  m_resultAttributeName = &name;
185  }
186 
187  private:
188 
189  const XalanDOMString* m_resultAttributeName;
190  };
191 
194 
198 
199  typedef XalanMap<const XalanDOMString*,
201 
202 
206  explicit
208 
219  StylesheetConstructionContext& theConstructionContext,
220  const NamespacesHandler& stylesheetNamespacesHandler,
221  const NamespacesStackType& theCurrentNamespaces,
222  const XalanDOMString& theXSLTNamespaceURI);
223 
225 
233  void
235  StylesheetConstructionContext& theConstructionContext,
236  const XalanDOMChar* theValue,
237  const NamespacesStackType& theCurrentNamespaces);
238 
246  void
248  StylesheetConstructionContext& theConstructionContext,
249  const XalanDOMChar* theValue,
250  const NamespacesStackType& theCurrentNamespaces);
251 
261  void
263  StylesheetConstructionContext& theConstructionContext,
264  bool fProcessNamespaceAliases = true,
266  const NamespacesHandler* parentNamespacesHandler = 0,
267  const PrefixChecker* prefixChecker = 0);
268 
270  operator=(const NamespacesHandler& theRHS);
271 
279  bool
281  const XalanDOMString& theXSLTNamespaceURI,
282  const XalanDOMString& theURI) const;
283 
290  void
292  StylesheetConstructionContext& theConstructionContext,
293  const XalanDOMString& theURI);
294 
301  const XalanDOMString*
302  getNamespace(const XalanDOMString& thePrefix) const;
303 
310  const XalanDOMString*
311  getNamespaceAlias(const XalanDOMString& theStylesheetNamespace) const;
312 
320  void
322  StylesheetConstructionContext& theConstructionContext,
323  const XalanDOMString& theStylesheetNamespace,
324  const XalanDOMString& theResultNamespace);
325 
331  void
332  copyNamespaceAliases(const NamespacesHandler& parentNamespacesHandler);
333 
340  void
342  StylesheetExecutionContext& theExecutionContext,
343  bool supressDefault = false) const;
344 
348  void
349  clear();
350 
356  void
357  swap(NamespacesHandler& theOther);
358 
361  {
362  return m_namespaceDeclarations.size();
363  }
364 
365 private:
366 
372  void
373  createResultAttributeNames(StylesheetConstructionContext& theConstructionContext);
374 
382  void
384  StylesheetConstructionContext& theConstructionContext,
385  const XalanDOMString& theElementPrefix,
386  const PrefixChecker* prefixChecker);
387 
391  void
392  processNamespaceAliases();
393 
399  void
400  copyNamespaceAliases(const NamespaceAliasesMapType& theNamespaceAliases);
401 
407  void
408  copyExtensionNamespaceURIs(const XalanDOMStringPointerVectorType& theExtensionNamespaceURIs);
409 
415  void
416  copyExcludeResultPrefixes(const NamespacesVectorType& theExcludeResultPrefixes);
417 
425  bool
426  isExcludedNamespaceURI(const XalanDOMString& theNamespaceURI) const;
427 
434  bool
435  isExtensionNamespaceURI(const XalanDOMString& theNamespaceURI) const
436  {
437  return findString(theNamespaceURI, m_extensionNamespaceURIs);
438  }
439 
446  static bool
447  findString(
448  const XalanDOMString& theString,
449  const XalanDOMStringPointerVectorType& theVector);
450 
451 
452  // Not implemented...
453  bool
454  operator==(const NamespacesHandler&) const;
455 
456 
457  // Data members...
458  NamespacesVectorType m_excludedResultPrefixes;
459 
460  NamespaceExtendedVectorType m_namespaceDeclarations;
461 
462  XalanDOMStringPointerVectorType m_extensionNamespaceURIs;
463 
464  NamespaceAliasesMapType m_namespaceAliases;
465 };
466 
467 
468 
469 XALAN_CPP_NAMESPACE_END
470 
471 
472 
473 #endif // XALAN_NAMESPACESHANDLER_HEADER_GUARD
void outputResultNamespaces(StylesheetExecutionContext &theExecutionContext, bool supressDefault=false) const
Output the result tree namespace declarations.
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1111
XalanVector< const XalanDOMString * > XalanDOMStringPointerVectorType
Definition: NamespacesHandler.hpp:197
NamespaceExtended(const XalanDOMString &prefix, const XalanDOMString &uri)
Definition: NamespacesHandler.hpp:155
void setURI(const XalanDOMString &uri)
Set the URI for namespace.
Definition: NamespacesHandler.hpp:129
void swap(NamespacesHandler &theOther)
Swap the contents of this instance with another.
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager MemoryManagerType
Definition: XalanMemoryManagement.hpp:39
void setResultAttributeName(const XalanDOMString &name)
Set the name of the result attribute.
Definition: NamespacesHandler.hpp:182
Namespace(const XalanDOMString &prefix, const XalanDOMString &uri)
Definition: NamespacesHandler.hpp:78
Definition: NamespacesHandler.hpp:50
void processExcludeResultPrefixes(StylesheetConstructionContext &theConstructionContext, const XalanDOMChar *theValue, const NamespacesStackType &theCurrentNamespaces)
Process an exclude-result-prefixes attribute.
NamespacesHandler(MemoryManagerType &theManager)
Create a default, empty instance.
Definition: StylesheetExecutionContext.hpp:104
void setPrefix(const XalanDOMString &prefix)
Set the prefix for namespace.
Definition: NamespacesHandler.hpp:105
bool shouldExcludeResultNamespaceNode(const XalanDOMString &theXSLTNamespaceURI, const XalanDOMString &theURI) const
Determine of a given namespace should be excluded.
NamespaceExtendedVectorType::size_type getNamespaceDeclarationsCount() const
Definition: NamespacesHandler.hpp:360
void setNamespaceAlias(StylesheetConstructionContext &theConstructionContext, const XalanDOMString &theStylesheetNamespace, const XalanDOMString &theResultNamespace)
Set the namespace alias URI for the given namespace.
void copyNamespaceAliases(const NamespacesHandler &parentNamespacesHandler)
Copy the aliases from the given NamespacesHandler.
const XalanDOMString & getURI() const
Retrieve the URI for namespace.
Definition: NamespacesHandler.hpp:116
static const XalanDOMString s_emptyString
Definition: NamespacesHandler.hpp:136
void addExtensionNamespaceURI(StylesheetConstructionContext &theConstructionContext, const XalanDOMString &theURI)
Add a URI as an extension namespace prefixes.
void postConstruction(StylesheetConstructionContext &theConstructionContext, bool fProcessNamespaceAliases=true, const XalanDOMString &theElementName=XalanDOMString(XalanMemMgrs::getDummyMemMgr()), const NamespacesHandler *parentNamespacesHandler=0, const PrefixChecker *prefixChecker=0)
Notify the instance that the stylesheet is fully constructed.
Definition: NamespacesHandler.hpp:55
NamespacesHandler & operator=(const NamespacesHandler &theRHS)
static MemoryManager & getDummyMemMgr()
const XalanDOMString * getNamespace(const XalanDOMString &thePrefix) const
Get the namespace URI for the given prefix.
const XalanDOMString * getNamespaceAlias(const XalanDOMString &theStylesheetNamespace) const
Get the namespace alias URI for the given namespace.
void processExtensionElementPrefixes(StylesheetConstructionContext &theConstructionContext, const XalanDOMChar *theValue, const NamespacesStackType &theCurrentNamespaces)
Process an extension-element-prefixes attribute.
void clear()
Clear out the handler.
XalanVector< NamespaceExtended > NamespaceExtendedVectorType
Definition: NamespacesHandler.hpp:196
size_t size_type
Definition: XalanVector.hpp:71
Definition: NamespacesHandler.hpp:145
XalanMap< const XalanDOMString *, const XalanDOMString * > NamespaceAliasesMapType
Definition: NamespacesHandler.hpp:200
#define XALAN_XSLT_EXPORT
Definition: XSLTDefinitions.hpp:25
Definition: XalanDOMString.hpp:42
Definition: StylesheetConstructionContext.hpp:73
XalanVector< Namespace > NamespacesVectorType
Definition: NamespacesHandler.hpp:195
Xalan implementation of a hashtable.
Definition: XalanMap.hpp:182
Definition: NamespacesHandler.hpp:68
Namespace()
Definition: NamespacesHandler.hpp:72
const XalanDOMString & getPrefix() const
Retrieve the prefix for namespace.
Definition: NamespacesHandler.hpp:92
const XalanDOMString & getResultAttributeName() const
Retrieve the name of the result attribute.
Definition: NamespacesHandler.hpp:169
XalanQName::NamespacesStackType NamespacesStackType
Definition: NamespacesHandler.hpp:193
XalanQName::NamespaceVectorType NamespaceVectorType
Definition: NamespacesHandler.hpp:192
NamespaceExtended()
Definition: NamespacesHandler.hpp:149
Xalan implementation of deque.
Definition: XalanDeque.hpp:160

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo