Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.4

Main Page   Namespace List   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-2002 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/XalanDOMStringPool.hpp>
00080 
00081 
00082 
00083 #include <XalanSourceTree/XalanSourceTreeAttributeAllocator.hpp>
00084 #include <XalanSourceTree/XalanSourceTreeAttributeNSAllocator.hpp>
00085 #include <XalanSourceTree/XalanSourceTreeAttributesVector.hpp>
00086 #include <XalanSourceTree/XalanSourceTreeCommentAllocator.hpp>
00087 #include <XalanSourceTree/XalanSourceTreeElementAllocator.hpp>
00088 #include <XalanSourceTree/XalanSourceTreeElementNSAllocator.hpp>
00089 #include <XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.hpp>
00090 #include <XalanSourceTree/XalanSourceTreeTextAllocator.hpp>
00091 #include <XalanSourceTree/XalanSourceTreeTextIWSAllocator.hpp>
00092 
00093 
00094 
00095 class AttributeList;
00096 class Attributes;
00097 class PrefixResolver;
00098 
00099 
00100 
00101 class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeDocument : public XalanDocument
00102 {
00103 public:
00104 
00105     typedef XalanSourceTreeElement::AttributesCountType     AttributesCountType;
00106 
00107 #if defined (XALAN_NO_NAMESPACES)
00108     typedef map<
00109                 const XalanDOMChar*,
00110                 XalanSourceTreeElement*,
00111                 less_null_terminated_arrays<XalanDOMChar> >     ElementByIDMapType;
00112 
00113     typedef map<
00114                 XalanDOMString,
00115                 XalanDOMString,
00116                 less<XalanDOMString> >                          UnparsedEntityURIMapType;
00117 
00118     typedef deque<XalanDOMString>                               StringCollectionType;
00119 #else
00120     typedef std::map<
00121                 const XalanDOMChar*,
00122                 XalanSourceTreeElement*,
00123                 less_null_terminated_arrays<XalanDOMChar> >     ElementByIDMapType;
00124 
00125     typedef std::map<
00126                 XalanDOMString,
00127                 XalanDOMString>                                 UnparsedEntityURIMapType;
00128 
00129     typedef std::deque<XalanDOMString>                          StringCollectionType;
00130 #endif
00131 
00135     static void
00136     initialize();
00137 
00141     static void
00142     terminate();
00143 
00144 
00145     enum { eDefaultAttributeAllocatorBlockSize = 100,
00146            eDefaultAttributeNSAllocatorBlockSize = 50,
00147            eDefaultCommentAllocatorBlockSize = 10,
00148            eDefaultElementAllocatorBlockSize = 100,
00149            eDefaultElementNSAllocatorBlockSize = 100,
00150            eDefaultPIAllocatorBlockSize = 10,
00151            eDefaultTextAllocatorBlockSize = 100,
00152            eDefaultTextIWSAllocatorBlockSize = 100,
00153            eDefaultNamesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize,
00154            eDefaultNamesStringPoolBucketCount = XalanDOMStringPool::eDefaultBucketCount,
00155            eDefaultNamesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize,
00156            eDefaultValuesStringPoolBlockSize = XalanDOMStringPool::eDefaultBlockSize,
00157            eDefaultValuesStringPoolBucketCount = 997,
00158            eDefaultValuesStringPoolBucketSize = XalanDOMStringPool::eDefaultBucketSize };
00159 
00160 
00161     typedef XalanSourceTreeAttributeAllocator::size_type    allocator_size_type;
00162     typedef XalanDOMStringPool::block_size_type             block_size_type;
00163     typedef XalanDOMStringPool::bucket_count_type           bucket_count_type;
00164     typedef XalanDOMStringPool::bucket_size_type            bucket_size_type;
00165 
00179     XalanSourceTreeDocument(
00180             bool                fPoolAllText = true,
00181             block_size_type     theNamesStringPoolBlockSize = eDefaultNamesStringPoolBlockSize,
00182             bucket_count_type   theNamesStringPoolBucketCount = eDefaultNamesStringPoolBucketCount,
00183             bucket_size_type    theNamesStringPoolBucketSize = eDefaultNamesStringPoolBucketSize,
00184             block_size_type     theValuesStringPoolBlockSize = eDefaultValuesStringPoolBlockSize,
00185             bucket_count_type   theValuesStringPoolBucketCount = eDefaultValuesStringPoolBucketCount,
00186             bucket_size_type    theValuesStringPoolBucketSize = eDefaultValuesStringPoolBucketSize);
00187 
00202     XalanSourceTreeDocument(
00203             allocator_size_type     theAttributeBlockSize,
00204             allocator_size_type     theAttributeNSBlockSize,
00205             allocator_size_type     theCommentBlockSize,
00206             allocator_size_type     theElementBlockSize,
00207             allocator_size_type     theElementNSBlockSize,
00208             allocator_size_type     thePIBlockSize,
00209             allocator_size_type     theTextBlockSize,
00210             allocator_size_type     theTextIWSBlockSize,
00211             bool                    fPoolAllText = true);
00212 
00213     virtual
00214     ~XalanSourceTreeDocument();
00215 
00216     // These interfaces are inherited from XalanNode...
00217 
00218     virtual const XalanDOMString&
00219     getNodeName() const;
00220 
00221     virtual const XalanDOMString&
00222     getNodeValue() const;
00223 
00224     virtual NodeType
00225     getNodeType() const;
00226 
00227     virtual XalanNode*
00228     getParentNode() const;
00229 
00230     virtual const XalanNodeList*
00231     getChildNodes() const;
00232 
00233     virtual XalanNode*
00234     getFirstChild() const;
00235 
00236     virtual XalanNode*
00237     getLastChild() const;
00238 
00239     virtual XalanNode*
00240     getPreviousSibling() const;
00241 
00242     virtual XalanNode*
00243     getNextSibling() const;
00244 
00245     virtual const XalanNamedNodeMap*
00246     getAttributes() const;
00247 
00248     virtual XalanDocument*
00249     getOwnerDocument() const;
00250 
00251 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
00252     virtual XalanNode*
00253 #else
00254     virtual XalanSourceTreeDocument*
00255 #endif
00256     cloneNode(bool deep) const;
00257 
00258     virtual XalanNode*
00259     insertBefore(
00260             XalanNode*  newChild,
00261             XalanNode*  refChild);
00262 
00263     virtual XalanNode*
00264     replaceChild(
00265             XalanNode*  newChild,
00266             XalanNode*  oldChild);
00267 
00268     virtual XalanNode*
00269     removeChild(XalanNode*  oldChild);
00270 
00271     virtual XalanNode*
00272     appendChild(XalanNode*  newChild);
00273 
00274     virtual bool
00275     hasChildNodes() const;
00276 
00277     virtual void
00278     setNodeValue(const XalanDOMString&      nodeValue);
00279 
00280     virtual void
00281     normalize();
00282 
00283     virtual bool
00284     isSupported(
00285             const XalanDOMString&   feature,
00286             const XalanDOMString&   version) const;
00287 
00288     virtual const XalanDOMString&
00289     getNamespaceURI() const;
00290 
00291     virtual const XalanDOMString&
00292     getPrefix() const;
00293 
00294     virtual const XalanDOMString&
00295     getLocalName() const;
00296 
00297     virtual void
00298     setPrefix(const XalanDOMString& prefix);
00299 
00300     virtual bool
00301     isIndexed() const;
00302 
00303     virtual unsigned long
00304     getIndex() const;
00305 
00306     virtual XalanElement*
00307     createElement(const XalanDOMString& tagName);
00308 
00309     virtual XalanDocumentFragment*
00310     createDocumentFragment();
00311 
00312     virtual XalanText*
00313     createTextNode(const XalanDOMString&    data);
00314 
00315     virtual XalanComment*
00316     createComment(const XalanDOMString& data);
00317 
00318     virtual XalanCDATASection*
00319     createCDATASection(const XalanDOMString&    data);
00320 
00321     virtual XalanProcessingInstruction*
00322     createProcessingInstruction(
00323             const XalanDOMString&   target,
00324             const XalanDOMString&   data);
00325 
00326     virtual XalanAttr*
00327     createAttribute(const XalanDOMString&   name);
00328 
00329     virtual XalanEntityReference*
00330     createEntityReference(const XalanDOMString& name);
00331 
00332     virtual XalanDocumentType*
00333     getDoctype() const;
00334 
00335     virtual XalanDOMImplementation*
00336     getImplementation() const;
00337 
00338     virtual XalanElement*
00339     getDocumentElement() const;
00340 
00341     virtual XalanNodeList*
00342     getElementsByTagName(const XalanDOMString&      tagname) const;
00343 
00344     virtual XalanNode*
00345     importNode(
00346             XalanNode*  importedNode,
00347             bool        deep);
00348 
00349     virtual XalanElement*
00350     createElementNS(
00351             const XalanDOMString&   namespaceURI,
00352             const XalanDOMString&   qualifiedName);
00353 
00354     virtual XalanAttr*
00355     createAttributeNS(
00356             const XalanDOMString& namespaceURI,
00357             const XalanDOMString& qualifiedName);
00358 
00359     virtual XalanNodeList*
00360     getElementsByTagNameNS(
00361             const XalanDOMString&   namespaceURI,
00362             const XalanDOMString&   localName) const;
00363 
00364     virtual XalanElement*
00365     getElementById(const XalanDOMString&    elementId) const;
00366 
00367 
00368     // Interfaces not inherited from XalanDocument...
00369 
00370     XalanSourceTreeElement*
00371     createElementNode(
00372             const XalanDOMChar*     name,
00373             const AttributeList&    attrs,
00374             XalanNode*              theParentNode = 0,
00375             XalanNode*              thePreviousSibling = 0,
00376             XalanNode*              theNextSibling = 0,
00377             bool                    fAddXMLNamespaceAttribute = false);
00378 
00379     XalanSourceTreeElement*
00380     createElementNode(
00381             const XalanDOMChar*         uri,
00382             const XalanDOMChar*         localname,
00383             const XalanDOMChar*         qname,
00384             const Attributes&           attrs,
00385             XalanNode*                  theParentNode = 0,
00386             XalanNode*                  thePreviousSibling = 0,
00387             XalanNode*                  theNextSibling = 0,
00388             bool                        fAddXMLNamespaceAttribute = false);
00389 
00390     XalanSourceTreeElement*
00391     createElementNode(
00392             const XalanDOMChar*         tagName,
00393             const AttributeList&        attrs,
00394             const PrefixResolver&       thePrefixResolver,
00395             XalanNode*                  theParentNode = 0,
00396             XalanNode*                  thePreviousSibling = 0,
00397             XalanNode*                  theNextSibling = 0,
00398             bool                        fAddXMLNamespaceAttribute = false);
00399 
00400     XalanSourceTreeElement*
00401     createElementNode(
00402             const XalanDOMChar*         name,
00403             const Attributes&           attrs,
00404             XalanNode*                  theParentNode = 0,
00405             XalanNode*                  thePreviousSibling = 0,
00406             XalanNode*                  theNextSibling = 0,
00407             bool                        fAddXMLNamespaceAttribute = false);
00408 
00409     XalanSourceTreeComment*
00410     createCommentNode(
00411             const XalanDOMChar*         data,
00412             XalanDOMString::size_type   length,
00413             XalanNode*                  theParentNode = 0,
00414             XalanNode*                  thePreviousSibling = 0,
00415             XalanNode*                  theNextSibling = 0);
00416 
00417     XalanSourceTreeProcessingInstruction*
00418     createProcessingInstructionNode(
00419             const XalanDOMChar*     target,
00420             const XalanDOMChar*     data,
00421             XalanNode*              theParentNode = 0,
00422             XalanNode*              thePreviousSibling = 0,
00423             XalanNode*              theNextSibling = 0);
00424 
00425     XalanSourceTreeText*
00426     createTextNode(
00427             const XalanDOMChar*         chars,
00428             XalanDOMString::size_type   length,
00429             XalanNode*                  theParentNode = 0,
00430             XalanNode*                  thePreviousSibling = 0,
00431             XalanNode*                  theNextSibling = 0);
00432 
00433     XalanSourceTreeText*
00434     createTextIWSNode(
00435             const XalanDOMChar*         chars,
00436             XalanDOMString::size_type   length,
00437             XalanNode*                  theParentNode = 0,
00438             XalanNode*                  thePreviousSibling = 0,
00439             XalanNode*                  theNextSibling = 0);
00440 
00441     void
00442     unparsedEntityDeclaration(
00443             const XalanDOMChar*     name,
00444             const XalanDOMChar*     publicId,
00445             const XalanDOMChar*     systemId,
00446             const XalanDOMChar*     notationName);
00447 
00448     const XalanDOMString&
00449     getUnparsedEntityURI(const XalanDOMString&  theName) const;
00450 
00451     // Child node setters...
00452     void
00453     appendChildNode(XalanSourceTreeComment*     theChild);
00454 
00455     void
00456     appendChildNode(XalanSourceTreeElement*     theChild);
00457 
00458     void
00459     appendChildNode(XalanSourceTreeProcessingInstruction*   theChild);
00460 
00461 private:
00462 
00463     // Helper functions...
00464     XalanSourceTreeAttr*
00465     createAttribute(
00466             const XalanDOMChar*         theName,
00467             const XalanDOMChar*         theValue,
00468             XalanSourceTreeElement*     theOwnerElement,
00469             const PrefixResolver&       thePrefixResolver);
00470 
00471     XalanSourceTreeAttr*
00472     createAttribute(
00473             const XalanDOMChar*         theName,
00474             const XalanDOMChar*         theValue,
00475             XalanSourceTreeElement*     theOwnerElement);
00476 
00477     XalanSourceTreeElement*
00478     createElementNode(
00479             const XalanDOMChar*     theTagName,
00480             XalanSourceTreeAttr**   theAttributeVector,
00481             AttributesCountType     theAttributeCount,
00482             XalanNode*              theParentNode,
00483             XalanNode*              thePreviousSibling,
00484             XalanNode*              theNextSibling,
00485             const PrefixResolver&   thePrefixResolver);
00486 
00487     void
00488     createAttributes(
00489             const Attributes&           theAttributes,
00490             XalanSourceTreeAttr**       theAttributeVector,
00491             XalanSourceTreeElement*     theOwnerElement,
00492             bool                        fAddXMLNamespaceAttribute);
00493 
00494     const XalanDOMString&
00495     getTextNodeString(
00496             const XalanDOMChar*         chars,
00497             XalanDOMString::size_type   length);
00498 
00499     const XalanDOMString*
00500     getNamespaceForPrefix(
00501             const XalanDOMChar*     theName,
00502             const PrefixResolver&   thePrefixResolver,
00503             XalanDOMString&         thePrefix,
00504             bool                    fUseDefault);
00505 
00506     // Not implemented...
00507     XalanSourceTreeDocument(const XalanSourceTreeDocument&  theSource);
00508 
00509     XalanSourceTreeDocument&
00510     operator=(const XalanSourceTreeDocument&    theRHS);
00511 
00512     bool
00513     operator==(const XalanSourceTreeDocument&   theRHS) const;
00514 
00515 
00516     // Data members...
00517     XalanNode*                                      m_firstChild;
00518 
00519     XalanSourceTreeElement*                         m_documentElement;
00520 
00521     XalanSourceTreeAttributeAllocator               m_attributeAllocator;
00522 
00523     XalanSourceTreeAttributeNSAllocator             m_attributeNSAllocator;
00524 
00525     XalanSourceTreeCommentAllocator                 m_commentAllocator;
00526 
00527     XalanSourceTreeElementAllocator                 m_elementAllocator;
00528 
00529     XalanSourceTreeElementNSAllocator               m_elementNSAllocator;
00530 
00531     XalanSourceTreeProcessingInstructionAllocator   m_piAllocator;
00532 
00533     XalanSourceTreeTextAllocator                    m_textAllocator;
00534 
00535     XalanSourceTreeTextIWSAllocator                 m_textIWSAllocator;
00536 
00537     XalanDOMStringPool                              m_namesStringPool;
00538 
00539     XalanDOMStringPool                              m_valuesStringPool;
00540 
00541     XalanSourceTreeAttributesVector                 m_attributesVector;
00542 
00543     unsigned int                                    m_nextIndexValue;
00544 
00545     const bool                                      m_poolAllText;
00546 
00547     ElementByIDMapType                              m_elementsByID;
00548 
00549     UnparsedEntityURIMapType                        m_unparsedEntityURIs;
00550 
00551     StringCollectionType                            m_nonPooledStrings;
00552 
00553     XalanDOMString                                  m_stringBuffer;
00554 
00555     static const XalanDOMString&                    s_nameString;
00556 };
00557 
00558 
00559 
00560 #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.4
Copyright © 2000, 2001, 2002 The Apache Software Foundation. All Rights Reserved.