## Xalan-C++ API Documentation

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

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

# XalanSourceTreeDocument.hpp

Go to the documentation of this file.

    00001 /*
    00002  * The Apache Software License, Version 1.1
    00003  *
    00004  *
    00005  * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    00006  * reserved.
    00007  *
    00008  * Redistribution and use in source and binary forms, with or without
    00009  * modification, are permitted provided that the following conditions
    00010  * are met:
    00011  *
    00012  * 1. Redistributions of source code must retain the above copyright
    00013  *    notice, this list of conditions and the following disclaimer.
    00014  *
    00015  * 2. Redistributions in binary form must reproduce the above copyright
    00016  *    notice, this list of conditions and the following disclaimer in
    00017  *    the documentation and/or other materials provided with the
    00018  *    distribution.
    00019  *
    00020  * 3. The end-user documentation included with the redistribution,
    00021  *    if any, must include the following acknowledgment:
    00022  *       "This product includes software developed by the
    00023  *        Apache Software Foundation (http://www.apache.org/)."
    00024  *    Alternately, this acknowledgment may appear in the software itself,
    00025  *    if and wherever such third-party acknowledgments normally appear.
    00026  *
    00027  * 4. The names "Xalan" and "Apache Software Foundation" must
    00028  *    not be used to endorse or promote products derived from this
    00029  *    software without prior written permission. For written
    00030  *    permission, please contact apache@apache.org.
    00031  *
    00032  * 5. Products derived from this software may not be called "Apache",
    00033  *    nor may "Apache" appear in their name, without prior written
    00034  *    permission of the Apache Software Foundation.
    00035  *
    00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    00039  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
    00040  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00041  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    00042  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    00043  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    00045  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    00046  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    00047  * SUCH DAMAGE.
    00048  * ====================================================================
    00049  *
    00050  * This software consists of voluntary contributions made by many
    00051  * individuals on behalf of the Apache Software Foundation and was
    00052  * originally based on software copyright (c) 1999, International
    00053  * Business Machines, Inc., http://www.ibm.com.  For more
    00054  * information on the Apache Software Foundation, please see
    00055  * <http://www.apache.org/>.
    00056  */
    00057 #if !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680)
    00058 #define XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680
    00059
    00060
    00061
    00062 #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
    00063
    00064
    00065
    00066 #include <deque>
    00067 #include <map>
    00068
    00069
    00070
    00071 #include <XalanDOM/XalanDocument.hpp>
    00072
    00073
    00074
    00075 #include <Include/STLHelper.hpp>
    00076
    00077
    00078
    00079 #include <PlatformSupport/XalanArrayAllocator.hpp>
    00080 #include <PlatformSupport/XalanDOMStringPool.hpp>
    00081
    00082
    00083
    00084 #include <XalanSourceTree/XalanSourceTreeAttributeAllocator.hpp>
    00085 #include <XalanSourceTree/XalanSourceTreeAttributeNSAllocator.hpp>
    00086 #include <XalanSourceTree/XalanSourceTreeCommentAllocator.hpp>
    00087 #include <XalanSourceTree/XalanSourceTreeElementAAllocator.hpp>
    00088 #include <XalanSourceTree/XalanSourceTreeElementANSAllocator.hpp>
    00089 #include <XalanSourceTree/XalanSourceTreeElementNAAllocator.hpp>
    00090 #include <XalanSourceTree/XalanSourceTreeElementNANSAllocator.hpp>
    00091 #include <XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.hpp>
    00092 #include <XalanSourceTree/XalanSourceTreeTextAllocator.hpp>
    00093 #include <XalanSourceTree/XalanSourceTreeTextIWSAllocator.hpp>
    00094
    00095
    00096
    00097 XALAN_DECLARE_XERCES_CLASS(Attributes)
    00098 XALAN_DECLARE_XERCES_CLASS(AttributeList)
    00099
    00100
    00101
    00102 XALAN_CPP_NAMESPACE_BEGIN
    00103
    00104
    00105
    00106 typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes       AttributesType;
    00107 typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList    AttributeListType;
    00108
    00109
    00110
    00111 class PrefixResolver;
    00112 class XalanSourceTreeAttr;
    00113
    00114
    00115
    00116 class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeDocument : public XalanDocument
    00117 {
    00118 public:
    00119
    00120     typedef XalanSourceTreeElementA::AttributesCountType    AttributesCountType;
    00121     typedef XalanArrayAllocator<XalanSourceTreeAttr*>       AttributesArrayAllocatorType;
    00122
    00123 #if defined(XALAN_NO_STD_NAMESPACE)
    00124     typedef map<
    00125                 const XalanDOMChar*,
    00126                 XalanSourceTreeElement*,
    00127                 less_null_terminated_arrays<XalanDOMChar> >     ElementByIDMapType;
    00128
    00129     typedef map<
    00130                 XalanDOMString,
    00131                 XalanDOMString,
    00132                 less<XalanDOMString> >                          UnparsedEntityURIMapType;
    00133
    00134     typedef deque<XalanDOMString>                               StringCollectionType;
    00135 #else
    00136     typedef std::map<
    00137                 const XalanDOMChar*,
    00138                 XalanSourceTreeElement*,
    00139                 less_null_terminated_arrays<XalanDOMChar> >     ElementByIDMapType;
    00140
    00141     typedef std::map<
    00142                 XalanDOMString,
    00143                 XalanDOMString>                                 UnparsedEntityURIMapType;
    00144
    00145     typedef std::deque<XalanDOMString>                          StringCollectionType;
    00146 #endif
    00147
    00151     static void
    00152     initialize();
    00153
    00157     static void
    00158     terminate();
    00159
    00160
    00161     enum { eDefaultAttributeAllocatorBlockSize = 100,
    00162            eDefaultAttributeNSAllocatorBlockSize = 50,
    00163            eDefaultCommentAllocatorBlockSize = 10,
    00164            eDefaultElementAllocatorBlockSize = 100,
    00165            eDefaultElementNSAllocatorBlockSize = 100,
    00166            eDefaultPIAllocatorBlockSize = 10,
    00167            eDefaultTextAllocatorBlockSize = 100,
    00168            eDefaultTextIWSAllocatorBlockSize = 100,
    00169            eDefaultNamesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize,
    00170            eDefaultNamesStringPoolBucketCount = XalanDOMStringPool::eDefaultBucketCount,
    00171            eDefaultNamesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize,
    00172            eDefaultValuesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize,
    00173            eDefaultValuesStringPoolBucketCount = 997,
    00174            eDefaultValuesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize };
    00175
    00176
    00177     typedef XalanSourceTreeAttributeAllocator::size_type    allocator_size_type;
    00178     typedef XalanDOMStringPool::block_size_type             block_size_type;
    00179     typedef XalanDOMStringPool::bucket_count_type           bucket_count_type;
    00180     typedef XalanDOMStringPool::bucket_size_type            bucket_size_type;
    00181
    00195     XalanSourceTreeDocument(
    00196             bool                fPoolAllText = true,
    00197             block_size_type     theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize,
    00198             bucket_count_type   theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount,
    00199             bucket_size_type    theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize,
    00200             block_size_type     theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize,
    00201             bucket_count_type   theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount,
    00202             bucket_size_type    theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize);
    00203
    00218     XalanSourceTreeDocument(
    00219             allocator_size_type     theAttributeBlockSize,
    00220             allocator_size_type     theAttributeNSBlockSize,
    00221             allocator_size_type     theCommentBlockSize,
    00222             allocator_size_type     theElementBlockSize,
    00223             allocator_size_type     theElementNSBlockSize,
    00224             allocator_size_type     thePIBlockSize,
    00225             allocator_size_type     theTextBlockSize,
    00226             allocator_size_type     theTextIWSBlockSize,
    00227             bool                    fPoolAllText = true);
    00228
    00229     virtual
    00230     ~XalanSourceTreeDocument();
    00231
    00232     // These interfaces are inherited from XalanNode...
    00233
    00234     virtual const XalanDOMString&
    00235     getNodeName() const;
    00236
    00237     virtual const XalanDOMString&
    00238     getNodeValue() const;
    00239
    00240     virtual NodeType
    00241     getNodeType() const;
    00242
    00243     virtual XalanNode*
    00244     getParentNode() const;
    00245
    00246     virtual const XalanNodeList*
    00247     getChildNodes() const;
    00248
    00249     virtual XalanNode*
    00250     getFirstChild() const;
    00251
    00252     virtual XalanNode*
    00253     getLastChild() const;
    00254
    00255     virtual XalanNode*
    00256     getPreviousSibling() const;
    00257
    00258     virtual XalanNode*
    00259     getNextSibling() const;
    00260
    00261     virtual const XalanNamedNodeMap*
    00262     getAttributes() const;
    00263
    00264     virtual XalanDocument*
    00265     getOwnerDocument() const;
    00266
    00267 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
    00268     virtual XalanNode*
    00269 #else
    00270     virtual XalanSourceTreeDocument*
    00271 #endif
    00272     cloneNode(bool deep) const;
    00273
    00274     virtual XalanNode*
    00275     insertBefore(
    00276             XalanNode*  newChild,
    00277             XalanNode*  refChild);
    00278
    00279     virtual XalanNode*
    00280     replaceChild(
    00281             XalanNode*  newChild,
    00282             XalanNode*  oldChild);
    00283
    00284     virtual XalanNode*
    00285     removeChild(XalanNode*  oldChild);
    00286
    00287     virtual XalanNode*
    00288     appendChild(XalanNode*  newChild);
    00289
    00290     virtual bool
    00291     hasChildNodes() const;
    00292
    00293     virtual void
    00294     setNodeValue(const XalanDOMString&      nodeValue);
    00295
    00296     virtual void
    00297     normalize();
    00298
    00299     virtual bool
    00300     isSupported(
    00301             const XalanDOMString&   feature,
    00302             const XalanDOMString&   version) const;
    00303
    00304     virtual const XalanDOMString&
    00305     getNamespaceURI() const;
    00306
    00307     virtual const XalanDOMString&
    00308     getPrefix() const;
    00309
    00310     virtual const XalanDOMString&
    00311     getLocalName() const;
    00312
    00313     virtual void
    00314     setPrefix(const XalanDOMString& prefix);
    00315
    00316     virtual bool
    00317     isIndexed() const;
    00318
    00319     virtual IndexType
    00320     getIndex() const;
    00321
    00322     virtual XalanElement*
    00323     createElement(const XalanDOMString& tagName);
    00324
    00325     virtual XalanDocumentFragment*
    00326     createDocumentFragment();
    00327
    00328     virtual XalanText*
    00329     createTextNode(const XalanDOMString&    data);
    00330
    00331     virtual XalanComment*
    00332     createComment(const XalanDOMString& data);
    00333
    00334     virtual XalanCDATASection*
    00335     createCDATASection(const XalanDOMString&    data);
    00336
    00337     virtual XalanProcessingInstruction*
    00338     createProcessingInstruction(
    00339             const XalanDOMString&   target,
    00340             const XalanDOMString&   data);
    00341
    00342     virtual XalanAttr*
    00343     createAttribute(const XalanDOMString&   name);
    00344
    00345     virtual XalanEntityReference*
    00346     createEntityReference(const XalanDOMString& name);
    00347
    00348     virtual XalanDocumentType*
    00349     getDoctype() const;
    00350
    00351     virtual XalanDOMImplementation*
    00352     getImplementation() const;
    00353
    00354     virtual XalanElement*
    00355     getDocumentElement() const;
    00356
    00357     virtual XalanNodeList*
    00358     getElementsByTagName(const XalanDOMString&      tagname) const;
    00359
    00360     virtual XalanNode*
    00361     importNode(
    00362             XalanNode*  importedNode,
    00363             bool        deep);
    00364
    00365     virtual XalanElement*
    00366     createElementNS(
    00367             const XalanDOMString&   namespaceURI,
    00368             const XalanDOMString&   qualifiedName);
    00369
    00370     virtual XalanAttr*
    00371     createAttributeNS(
    00372             const XalanDOMString& namespaceURI,
    00373             const XalanDOMString& qualifiedName);
    00374
    00375     virtual XalanNodeList*
    00376     getElementsByTagNameNS(
    00377             const XalanDOMString&   namespaceURI,
    00378             const XalanDOMString&   localName) const;
    00379
    00380     virtual XalanElement*
    00381     getElementById(const XalanDOMString&    elementId) const;
    00382
    00383
    00384     // Interfaces not inherited from XalanDocument...
    00385
    00386     XalanSourceTreeElement*
    00387     createElementNode(
    00388             const XalanDOMChar*         name,
    00389             const AttributeListType&    attrs,
    00390             XalanNode*                  theParentNode = 0,
    00391             XalanNode*                  thePreviousSibling = 0,
    00392             XalanNode*                  theNextSibling = 0,
    00393             bool                        fAddXMLNamespaceAttribute = false);
    00394
    00395     XalanSourceTreeElement*
    00396     createElementNode(
    00397             const XalanDOMChar*         uri,
    00398             const XalanDOMChar*         localname,
    00399             const XalanDOMChar*         qname,
    00400             const AttributesType&       attrs,
    00401             XalanNode*                  theParentNode = 0,
    00402             XalanNode*                  thePreviousSibling = 0,
    00403             XalanNode*                  theNextSibling = 0,
    00404             bool                        fAddXMLNamespaceAttribute = false);
    00405
    00406     XalanSourceTreeElement*
    00407     createElementNode(
    00408             const XalanDOMChar*         tagName,
    00409             const AttributeListType&    attrs,
    00410             const PrefixResolver&       thePrefixResolver,
    00411             XalanNode*                  theParentNode = 0,
    00412             XalanNode*                  thePreviousSibling = 0,
    00413             XalanNode*                  theNextSibling = 0,
    00414             bool                        fAddXMLNamespaceAttribute = false);
    00415
    00416     XalanSourceTreeElement*
    00417     createElementNode(
    00418             const XalanDOMChar*         name,
    00419             const AttributesType&       attrs,
    00420             XalanNode*                  theParentNode = 0,
    00421             XalanNode*                  thePreviousSibling = 0,
    00422             XalanNode*                  theNextSibling = 0,
    00423             bool                        fAddXMLNamespaceAttribute = false);
    00424
    00425     XalanSourceTreeComment*
    00426     createCommentNode(
    00427             const XalanDOMChar*         data,
    00428             XalanDOMString::size_type   length,
    00429             XalanNode*                  theParentNode = 0,
    00430             XalanNode*                  thePreviousSibling = 0,
    00431             XalanNode*                  theNextSibling = 0);
    00432
    00433     XalanSourceTreeProcessingInstruction*
    00434     createProcessingInstructionNode(
    00435             const XalanDOMChar*     target,
    00436             const XalanDOMChar*     data,
    00437             XalanNode*              theParentNode = 0,
    00438             XalanNode*              thePreviousSibling = 0,
    00439             XalanNode*              theNextSibling = 0);
    00440
    00441     XalanSourceTreeText*
    00442     createTextNode(
    00443             const XalanDOMChar*         chars,
    00444             XalanDOMString::size_type   length,
    00445             XalanNode*                  theParentNode = 0,
    00446             XalanNode*                  thePreviousSibling = 0,
    00447             XalanNode*                  theNextSibling = 0);
    00448
    00449     XalanSourceTreeText*
    00450     createTextIWSNode(
    00451             const XalanDOMChar*         chars,
    00452             XalanDOMString::size_type   length,
    00453             XalanNode*                  theParentNode = 0,
    00454             XalanNode*                  thePreviousSibling = 0,
    00455             XalanNode*                  theNextSibling = 0);
    00456
    00457     void
    00458     unparsedEntityDeclaration(
    00459             const XalanDOMChar*     name,
    00460             const XalanDOMChar*     publicId,
    00461             const XalanDOMChar*     systemId,
    00462             const XalanDOMChar*     notationName);
    00463
    00464     const XalanDOMString&
    00465     getUnparsedEntityURI(const XalanDOMString&  theName) const;
    00466
    00467     // Child node setters...
    00468     void
    00469     appendChildNode(XalanSourceTreeComment*     theChild);
    00470
    00471     void
    00472     appendChildNode(XalanSourceTreeElement*     theChild);
    00473
    00474     void
    00475     appendChildNode(XalanSourceTreeProcessingInstruction*   theChild);
    00476
    00477 private:
    00478
    00479     // Helper functions...
    00480     XalanSourceTreeAttr*
    00481     createAttribute(
    00482             const XalanDOMChar*         theName,
    00483             const XalanDOMChar*         theValue,
    00484             XalanSourceTreeElement*     theOwnerElement,
    00485             const PrefixResolver&       thePrefixResolver);
    00486
    00487     XalanSourceTreeAttr*
    00488     createAttribute(
    00489             const XalanDOMChar*         theName,
    00490             const XalanDOMChar*         theValue,
    00491             XalanSourceTreeElement*     theOwnerElement);
    00492
    00493     size_t
    00494     createAttributes(
    00495             XalanSourceTreeAttr**       theAttributeVector,
    00496             const AttributeListType&    attrs,
    00497             size_t                      theStartIndex,
    00498             XalanSourceTreeElement*     theOwnerElement,
    00499             bool                        fCreateNamespaces);
    00500
    00501     XalanSourceTreeElement*
    00502     createElementNode(
    00503             const XalanDOMChar*     theTagName,
    00504             XalanSourceTreeAttr**   theAttributeVector,
    00505             AttributesCountType     theAttributeCount,
    00506             XalanNode*              theParentNode,
    00507             XalanNode*              thePreviousSibling,
    00508             XalanNode*              theNextSibling,
    00509             const PrefixResolver&   thePrefixResolver);
    00510
    00511     size_t
    00512     createAttributes(
    00513             XalanSourceTreeAttr**       theAttributeVector,
    00514             const AttributesType&       theAttributes,
    00515             size_t                      theStartIndex,
    00516             XalanSourceTreeElement*     theOwnerElement,
    00517             bool                        fCreateNamespaces);
    00518
    00519     void
    00520     createAttributes(
    00521             const AttributesType&       theAttributes,
    00522             XalanSourceTreeAttr**       theAttributeVector,
    00523             XalanSourceTreeElement*     theOwnerElement,
    00524             bool                        fAddXMLNamespaceAttribute);
    00525
    00526     const XalanDOMString&
    00527     getTextNodeString(
    00528             const XalanDOMChar*         chars,
    00529             XalanDOMString::size_type   length);
    00530
    00531     const XalanDOMString*
    00532     getNamespaceForPrefix(
    00533             const XalanDOMChar*     theName,
    00534             const PrefixResolver&   thePrefixResolver,
    00535             XalanDOMString&         thePrefix,
    00536             bool                    fUseDefault);
    00537
    00538     // Not implemented...
    00539     XalanSourceTreeDocument(const XalanSourceTreeDocument&  theSource);
    00540
    00541     XalanSourceTreeDocument&
    00542     operator=(const XalanSourceTreeDocument&    theRHS);
    00543
    00544     bool
    00545     operator==(const XalanSourceTreeDocument&   theRHS) const;
    00546
    00547
    00548     // Data members...
    00549     XalanNode*                                      m_firstChild;
    00550
    00551     XalanSourceTreeElement*                         m_documentElement;
    00552
    00553     XalanSourceTreeAttributeAllocator               m_attributeAllocator;
    00554
    00555     XalanSourceTreeAttributeNSAllocator             m_attributeNSAllocator;
    00556
    00557     XalanSourceTreeCommentAllocator                 m_commentAllocator;
    00558
    00559     XalanSourceTreeElementAAllocator                m_elementAAllocator;
    00560
    00561     XalanSourceTreeElementANSAllocator              m_elementANSAllocator;
    00562
    00563     XalanSourceTreeElementNAAllocator               m_elementNAAllocator;
    00564
    00565     XalanSourceTreeElementNANSAllocator             m_elementNANSAllocator;
    00566
    00567     XalanSourceTreeProcessingInstructionAllocator   m_piAllocator;
    00568
    00569     XalanSourceTreeTextAllocator                    m_textAllocator;
    00570
    00571     XalanSourceTreeTextIWSAllocator                 m_textIWSAllocator;
    00572
    00573     XalanDOMStringPool                              m_namesStringPool;
    00574
    00575     XalanDOMStringPool                              m_valuesStringPool;
    00576
    00577     AttributesArrayAllocatorType                    m_attributesVector;
    00578
    00579     IndexType                                       m_nextIndexValue;
    00580
    00581     const bool                                      m_poolAllText;
    00582
    00583     ElementByIDMapType                              m_elementsByID;
    00584
    00585     UnparsedEntityURIMapType                        m_unparsedEntityURIs;
    00586
    00587     StringCollectionType                            m_nonPooledStrings;
    00588
    00589     XalanDOMString                                  m_stringBuffer;
    00590
    00591     static const XalanDOMString&                    s_nameString;
    00592 };
    00593
    00594
    00595
    00596 XALAN_CPP_NAMESPACE_END
    00597
    00598
    00599
    00600 #endif  // !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680)

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.5 Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation. All Rights Reserved.