## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.10

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# NamespacesHandler.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Copyright 1999-2004 The Apache Software Foundation.
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  *     http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 #if !defined(XALAN_NAMESPACESHANDLER_HEADER_GUARD)
    00018 #define XALAN_NAMESPACESHANDLER_HEADER_GUARD
    00019
    00020
    00021
    00022 // Base include file.  Must be first.
    00023 #include <xalanc/XSLT/XSLTDefinitions.hpp>
    00024
    00025
    00026
    00027 #include <xalanc/Include/XalanVector.hpp>
    00028 #include <xalanc/Include/XalanMap.hpp>
    00029
    00030
    00031
    00032 #include <xalanc/PlatformSupport/DOMStringHelper.hpp>
    00033
    00034
    00035
    00036 #include <xalanc/XPath/NameSpace.hpp>
    00037 #include <xalanc/XPath/XalanQName.hpp>
    00038
    00039
    00040
    00041 XALAN_CPP_NAMESPACE_BEGIN
    00042
    00043
    00044
    00045 class StylesheetConstructionContext;
    00046 class StylesheetExecutionContext;
    00047
    00048
    00049
    00050 class XALAN_XSLT_EXPORT NamespacesHandler
    00051 {
    00052
    00053 public:
    00054
    00055     class PrefixChecker
    00056     {
    00057     public:
    00058
    00059         PrefixChecker();
    00060
    00061         virtual
    00062         ~PrefixChecker();
    00063
    00064         virtual bool
    00065         isActive(const XalanDOMString&  thePrefix) const = 0;
    00066     };
    00067
    00068     class XALAN_XSLT_EXPORT Namespace
    00069     {
    00070     public:
    00071
    00072         Namespace() :
    00073             m_prefix(&s_emptyString),
    00074             m_uri(&s_emptyString)
    00075         {
    00076         }
    00077
    00078         Namespace(
    00079                     const XalanDOMString&   prefix,
    00080                     const XalanDOMString&   uri) :
    00081             m_prefix(&prefix),
    00082             m_uri(&uri)
    00083         {
    00084         }
    00085
    00091         const XalanDOMString&
    00092         getPrefix() const
    00093         {
    00094             assert(m_prefix != 0);
    00095
    00096             return *m_prefix;
    00097         }
    00098
    00104         void
    00105         setPrefix(const XalanDOMString&     prefix)
    00106         {
    00107             m_prefix = &prefix;
    00108         }
    00109
    00115         const XalanDOMString&
    00116         getURI() const
    00117         {
    00118             assert(m_uri != 0);
    00119
    00120             return *m_uri;
    00121         }
    00122
    00128         void
    00129         setURI(const XalanDOMString&    uri)
    00130         {
    00131             m_uri = &uri;
    00132         }
    00133
    00134     protected:
    00135
    00136         static const XalanDOMString     s_emptyString;
    00137
    00138     private:
    00139
    00140         const XalanDOMString*   m_prefix;
    00141
    00142         const XalanDOMString*   m_uri;
    00143     };
    00144
    00145     class XALAN_XSLT_EXPORT NamespaceExtended : public Namespace
    00146     {
    00147     public:
    00148
    00149         NamespaceExtended() :
    00150             Namespace(),
    00151             m_resultAttributeName(&s_emptyString)
    00152         {
    00153         }
    00154
    00155         NamespaceExtended(
    00156                     const XalanDOMString&   prefix,
    00157                     const XalanDOMString&   uri) :
    00158             Namespace(prefix, uri),
    00159             m_resultAttributeName(&s_emptyString)
    00160         {
    00161         }
    00162
    00168         const XalanDOMString&
    00169         getResultAttributeName() const
    00170         {
    00171             assert(m_resultAttributeName != 0);
    00172
    00173             return *m_resultAttributeName;
    00174         }
    00175
    00181         void
    00182         setResultAttributeName(const XalanDOMString&    name)
    00183         {
    00184             m_resultAttributeName = &name;
    00185         }
    00186
    00187     private:
    00188
    00189         const XalanDOMString*   m_resultAttributeName;
    00190     };
    00191
    00192     typedef XalanQName::NamespaceVectorType             NamespaceVectorType;
    00193     typedef XalanQName::NamespacesStackType             NamespacesStackType;
    00194
    00195     typedef XalanVector<Namespace>                      NamespacesVectorType;
    00196     typedef XalanVector<NamespaceExtended>              NamespaceExtendedVectorType;
    00197     typedef XalanVector<const XalanDOMString*>          XalanDOMStringPointerVectorType;
    00198
    00199     typedef XalanMap<const XalanDOMString*,
    00200                     const XalanDOMString*>              NamespaceAliasesMapType;
    00201
    00202
    00206     explicit
    00207     NamespacesHandler(MemoryManagerType& theManager);
    00208
    00218     NamespacesHandler(
    00219             StylesheetConstructionContext&  theConstructionContext,
    00220             const NamespacesHandler&        stylesheetNamespacesHandler,
    00221             const NamespacesStackType&      theCurrentNamespaces,
    00222             const XalanDOMString&           theXSLTNamespaceURI);
    00223
    00224     ~NamespacesHandler();
    00225
    00233     void
    00234     processExcludeResultPrefixes(
    00235             StylesheetConstructionContext&  theConstructionContext,
    00236             const XalanDOMChar*             theValue,
    00237             const NamespacesStackType&      theCurrentNamespaces);
    00238
    00246     void
    00247     processExtensionElementPrefixes(
    00248             StylesheetConstructionContext&  theConstructionContext,
    00249             const XalanDOMChar*             theValue,
    00250             const NamespacesStackType&      theCurrentNamespaces);
    00251
    00261     void
    00262     postConstruction(
    00263             StylesheetConstructionContext&  theConstructionContext,
    00264             bool                            fProcessNamespaceAliases = true,
    00265             const XalanDOMString&           theElementName = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
    00266             const NamespacesHandler*        parentNamespacesHandler = 0,
    00267             const PrefixChecker*            prefixChecker = 0);
    00268
    00269     NamespacesHandler&
    00270     operator=(const NamespacesHandler&  theRHS);
    00271
    00279     bool
    00280     shouldExcludeResultNamespaceNode(
    00281             const XalanDOMString&   theXSLTNamespaceURI,
    00282             const XalanDOMString&   theURI) const;
    00283
    00290     void
    00291     addExtensionNamespaceURI(
    00292             StylesheetConstructionContext&  theConstructionContext,
    00293             const XalanDOMString&   theURI);
    00294
    00301     const XalanDOMString*
    00302     getNamespace(const XalanDOMString&  thePrefix) const;
    00303
    00310     const XalanDOMString*
    00311     getNamespaceAlias(const XalanDOMString&     theStylesheetNamespace) const;
    00312
    00320     void
    00321     setNamespaceAlias(
    00322             StylesheetConstructionContext&  theConstructionContext,
    00323             const XalanDOMString&           theStylesheetNamespace,
    00324             const XalanDOMString&           theResultNamespace);
    00325
    00331     void
    00332     copyNamespaceAliases(const NamespacesHandler&   parentNamespacesHandler);
    00333
    00340     void
    00341     outputResultNamespaces(
    00342             StylesheetExecutionContext&     theExecutionContext,
    00343             bool                            supressDefault = false) const;
    00344
    00348     void
    00349     clear();
    00350
    00356     void
    00357     swap(NamespacesHandler&     theOther);
    00358
    00359     NamespaceExtendedVectorType::size_type
    00360     getNamespaceDeclarationsCount() const
    00361     {
    00362         return m_namespaceDeclarations.size();
    00363     }
    00364
    00365 private:
    00366
    00372     void
    00373     createResultAttributeNames(StylesheetConstructionContext&   theConstructionContext);
    00374
    00382     void
    00383     processExcludeResultPrefixes(
    00384             StylesheetConstructionContext&  theConstructionContext,
    00385             const XalanDOMString&           theElementPrefix,
    00386             const PrefixChecker*            prefixChecker);
    00387
    00391     void
    00392     processNamespaceAliases();
    00393
    00399     void
    00400     copyNamespaceAliases(const NamespaceAliasesMapType&     theNamespaceAliases);
    00401
    00407     void
    00408     copyExtensionNamespaceURIs(const XalanDOMStringPointerVectorType&   theExtensionNamespaceURIs);
    00409
    00415     void
    00416     copyExcludeResultPrefixes(const NamespacesVectorType&   theExcludeResultPrefixes);
    00417
    00425     bool
    00426     isExcludedNamespaceURI(const XalanDOMString&    theNamespaceURI) const;
    00427
    00434     bool
    00435     isExtensionNamespaceURI(const XalanDOMString&   theNamespaceURI) const
    00436     {
    00437         return findString(theNamespaceURI, m_extensionNamespaceURIs);
    00438     }
    00439
    00446     static bool
    00447     findString(
    00448             const XalanDOMString&                   theString,
    00449             const XalanDOMStringPointerVectorType&  theVector);
    00450
    00451
    00452     // Not implemented...
    00453     bool
    00454     operator==(const NamespacesHandler&) const;
    00455
    00456
    00457     // Data members...
    00458     NamespacesVectorType                m_excludedResultPrefixes;
    00459
    00460     NamespaceExtendedVectorType         m_namespaceDeclarations;
    00461
    00462     XalanDOMStringPointerVectorType     m_extensionNamespaceURIs;
    00463
    00464     NamespaceAliasesMapType             m_namespaceAliases;
    00465 };
    00466
    00467
    00468
    00469 XALAN_CPP_NAMESPACE_END
    00470
    00471
    00472
    00473 #endif  // XALAN_NAMESPACESHANDLER_HEADER_GUARD

Interpreting class diagrams

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

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