Xalan-C++ API Documentation

The Xalan C++ XSL Transformer Version 1.1

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-2000 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 <PlatformSupport/STLHelper.hpp>
00076 #include <PlatformSupport/XalanDOMStringPool.hpp>
00077 
00078 
00079 
00080 #include <XalanSourceTree/XalanSourceTreeAttributeAllocator.hpp>
00081 #include <XalanSourceTree/XalanSourceTreeAttributeNSAllocator.hpp>
00082 #include <XalanSourceTree/XalanSourceTreeAttributesVector.hpp>
00083 #include <XalanSourceTree/XalanSourceTreeCommentAllocator.hpp>
00084 #include <XalanSourceTree/XalanSourceTreeElementAllocator.hpp>
00085 #include <XalanSourceTree/XalanSourceTreeElementNSAllocator.hpp>
00086 #include <XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.hpp>
00087 #include <XalanSourceTree/XalanSourceTreeTextAllocator.hpp>
00088 #include <XalanSourceTree/XalanSourceTreeTextIWSAllocator.hpp>
00089 
00090 
00091 
00092 class AttributeList;
00093 class Attributes;
00094 
00095 
00096 
00097 class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeDocument : public XalanDocument
00098 {
00099 public:
00100 
00101     typedef XalanSourceTreeElement::AttributesCountType     AttributesCountType;
00102 
00103 #if defined (XALAN_NO_NAMESPACES)
00104     typedef map<
00105                 const XalanDOMChar*,
00106                 XalanSourceTreeElement*,
00107                 less_null_terminated_arrays<XalanDOMChar> >     ElementByIDMapType;
00108 
00109     typedef map<
00110                 XalanDOMString,
00111                 XalanDOMString,
00112                 less<XalanDOMString> >                          UnparsedEntityURIMapType;
00113 
00114     typedef deque<XalanDOMString>                               StringCollectionType;
00115 #else
00116     typedef std::map<
00117                 const XalanDOMChar*,
00118                 XalanSourceTreeElement*,
00119                 less_null_terminated_arrays<XalanDOMChar> >     ElementByIDMapType;
00120 
00121     typedef std::map<
00122                 XalanDOMString,
00123                 XalanDOMString>                                 UnparsedEntityURIMapType;
00124 
00125     typedef std::deque<XalanDOMString>                          StringCollectionType;
00126 #endif
00127 
00131     static void
00132     initialize();
00133 
00137     static void
00138     terminate();
00139 
00140 
00148     XalanSourceTreeDocument(bool    fPoolAllText = true);
00149 
00150     virtual
00151     ~XalanSourceTreeDocument();
00152 
00153     // These interfaces are inherited from XalanNode...
00154 
00155     virtual const XalanDOMString&
00156     getNodeName() const;
00157 
00158     virtual const XalanDOMString&
00159     getNodeValue() const;
00160 
00161     virtual NodeType
00162     getNodeType() const;
00163 
00164     virtual XalanNode*
00165     getParentNode() const;
00166 
00167     virtual const XalanNodeList*
00168     getChildNodes() const;
00169 
00170     virtual XalanNode*
00171     getFirstChild() const;
00172 
00173     virtual XalanNode*
00174     getLastChild() const;
00175 
00176     virtual XalanNode*
00177     getPreviousSibling() const;
00178 
00179     virtual XalanNode*
00180     getNextSibling() const;
00181 
00182     virtual const XalanNamedNodeMap*
00183     getAttributes() const;
00184 
00185     virtual XalanDocument*
00186     getOwnerDocument() const;
00187 
00188 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
00189     virtual XalanNode*
00190 #else
00191     virtual XalanSourceTreeDocument*
00192 #endif
00193     cloneNode(bool deep) const;
00194 
00195     virtual XalanNode*
00196     insertBefore(
00197             XalanNode*  newChild,
00198             XalanNode*  refChild);
00199 
00200     virtual XalanNode*
00201     replaceChild(
00202             XalanNode*  newChild,
00203             XalanNode*  oldChild);
00204 
00205     virtual XalanNode*
00206     removeChild(XalanNode*  oldChild);
00207 
00208     virtual XalanNode*
00209     appendChild(XalanNode*  newChild);
00210 
00211     virtual bool
00212     hasChildNodes() const;
00213 
00214     virtual void
00215     setNodeValue(const XalanDOMString&      nodeValue);
00216 
00217     virtual void
00218     normalize();
00219 
00220     virtual bool
00221     supports(
00222             const XalanDOMString&   feature,
00223             const XalanDOMString&   version) const;
00224 
00225     virtual const XalanDOMString&
00226     getNamespaceURI() const;
00227 
00228     virtual const XalanDOMString&
00229     getPrefix() const;
00230 
00231     virtual const XalanDOMString&
00232     getLocalName() const;
00233 
00234     virtual void
00235     setPrefix(const XalanDOMString& prefix);
00236 
00237     virtual bool
00238     isIndexed() const;
00239 
00240     virtual unsigned long
00241     getIndex() const;
00242 
00243     virtual XalanElement*
00244     createElement(const XalanDOMString& tagName);
00245 
00246     virtual XalanDocumentFragment*
00247     createDocumentFragment();
00248 
00249     virtual XalanText*
00250     createTextNode(const XalanDOMString&    data);
00251 
00252     virtual XalanComment*
00253     createComment(const XalanDOMString& data);
00254 
00255     virtual XalanCDATASection*
00256     createCDATASection(const XalanDOMString&    data);
00257 
00258     virtual XalanProcessingInstruction*
00259     createProcessingInstruction(
00260             const XalanDOMString&   target,
00261             const XalanDOMString&   data);
00262 
00263     virtual XalanAttr*
00264     createAttribute(const XalanDOMString&   name);
00265 
00266     virtual XalanEntityReference*
00267     createEntityReference(const XalanDOMString& name);
00268 
00269     virtual XalanDocumentType*
00270     getDoctype() const;
00271 
00272     virtual XalanDOMImplementation*
00273     getImplementation() const;
00274 
00275     virtual XalanElement*
00276     getDocumentElement() const;
00277 
00278     virtual XalanNodeList*
00279     getElementsByTagName(const XalanDOMString&      tagname) const;
00280 
00281     virtual XalanNode*
00282     importNode(
00283             XalanNode*  importedNode,
00284             bool        deep);
00285 
00286     virtual XalanElement*
00287     createElementNS(
00288             const XalanDOMString&   namespaceURI,
00289             const XalanDOMString&   qualifiedName);
00290 
00291     virtual XalanAttr*
00292     createAttributeNS(
00293             const XalanDOMString& namespaceURI,
00294             const XalanDOMString& qualifiedName);
00295 
00296     virtual XalanNodeList*
00297     getElementsByTagNameNS(
00298             const XalanDOMString&   namespaceURI,
00299             const XalanDOMString&   localName) const;
00300 
00301     virtual XalanElement*
00302     getElementById(const XalanDOMString&    elementId) const;
00303 
00304 
00305     // Interfaces not inherited from XalanDocument...
00306 
00307     XalanSourceTreeElement*
00308     createElementNode(
00309             const XalanDOMChar*         name,
00310             const AttributeList&        attrs,
00311             XalanSourceTreeElement*     theParentElement = 0,
00312             XalanNode*                  thePreviousSibling = 0,
00313             XalanNode*                  theNextSibling = 0);
00314 
00315     XalanSourceTreeElement*
00316     createElementNode(
00317             const XalanDOMChar*         uri,
00318             const XalanDOMChar*         localname,
00319             const XalanDOMChar*         qname,
00320             const Attributes&           attrs,
00321             XalanSourceTreeElement*     theParentElement = 0,
00322             XalanNode*                  thePreviousSibling = 0,
00323             XalanNode*                  theNextSibling = 0);
00324 
00325     XalanSourceTreeElement*
00326     createElementNode(
00327             const XalanDOMChar*         name,
00328             const Attributes&           attrs,
00329             XalanSourceTreeElement*     theParentElement = 0,
00330             XalanNode*                  thePreviousSibling = 0,
00331             XalanNode*                  theNextSibling = 0);
00332 
00333     XalanSourceTreeComment*
00334     createCommentNode(
00335             const XalanDOMChar*         data,
00336             unsigned int                length,
00337             XalanSourceTreeElement*     theParentElement = 0,
00338             XalanNode*                  thePreviousSibling = 0,
00339             XalanNode*                  theNextSibling = 0);
00340 
00341     XalanSourceTreeProcessingInstruction*
00342     createProcessingInstructionNode(
00343             const XalanDOMChar*         target,
00344             const XalanDOMChar*         data,
00345             XalanSourceTreeElement*     theParentElement = 0,
00346             XalanNode*                  thePreviousSibling = 0,
00347             XalanNode*                  theNextSibling = 0);
00348 
00349     XalanSourceTreeText*
00350     createTextNode(
00351             const XalanDOMChar*         chars,
00352             unsigned int                length,
00353             XalanSourceTreeElement*     theParentElement = 0,
00354             XalanNode*                  thePreviousSibling = 0,
00355             XalanNode*                  theNextSibling = 0);
00356 
00357     XalanSourceTreeText*
00358     createTextIWSNode(
00359             const XalanDOMChar*         chars,
00360             unsigned int                length,
00361             XalanSourceTreeElement*     theParentElement = 0,
00362             XalanNode*                  thePreviousSibling = 0,
00363             XalanNode*                  theNextSibling = 0);
00364 
00365     void
00366     unparsedEntityDeclaration(
00367             const XalanDOMChar*     name,
00368             const XalanDOMChar*     publicId,
00369             const XalanDOMChar*     systemId,
00370             const XalanDOMChar*     notationName);
00371 
00372     const XalanDOMString&
00373     getUnparsedEntityURI(const XalanDOMString&  theName) const;
00374 
00375     // Child node setters...
00376     void
00377     appendChildNode(XalanSourceTreeComment*     theChild);
00378 
00379     void
00380     appendChildNode(XalanSourceTreeElement*     theChild);
00381 
00382     void
00383     appendChildNode(XalanSourceTreeProcessingInstruction*   theChild);
00384 
00385 private:
00386 
00387     // Helper functions...
00388     XalanSourceTreeAttr*
00389     createAttribute(
00390             const XalanDOMChar*         theName,
00391             const XalanDOMChar*         theValue,
00392             XalanSourceTreeElement*     theOwnerElement);
00393 
00394     XalanSourceTreeElement*
00395     createElement(
00396             const XalanDOMChar*         theTagName,
00397             XalanSourceTreeAttr**       theAttributeVector,
00398             AttributesCountType         theAttributeCount,
00399             XalanSourceTreeElement*     theParentElement,
00400             XalanNode*                  thePreviousSibling,
00401             XalanNode*                  theNextSibling);
00402 
00403     void
00404     createAttributes(
00405             const Attributes&           theAttributes,
00406             XalanSourceTreeAttr**       theAttributeVector,
00407             AttributesCountType         theAttributeCount,
00408             XalanSourceTreeElement*     theOwnerElement);
00409 
00410     const XalanDOMString&
00411     getTextNodeString(
00412             const XalanDOMChar*         chars,
00413             unsigned int                length);
00414 
00415 
00416     // Not implemented...
00417     XalanSourceTreeDocument(const XalanSourceTreeDocument&  theSource);
00418 
00419     XalanSourceTreeDocument&
00420     operator=(const XalanSourceTreeDocument&    theRHS);
00421 
00422     bool
00423     operator==(const XalanSourceTreeDocument&   theRHS) const;
00424 
00425 
00426     // Data members...
00427     XalanNode*                                      m_firstChild;
00428 
00429     XalanSourceTreeElement*                         m_documentElement;
00430 
00431     XalanSourceTreeAttributeAllocator               m_attributeAllocator;
00432 
00433     XalanSourceTreeAttributeNSAllocator             m_attributeNSAllocator;
00434 
00435     XalanSourceTreeCommentAllocator                 m_commentAllocator;
00436 
00437     XalanSourceTreeElementAllocator                 m_elementAllocator;
00438 
00439     XalanSourceTreeElementNSAllocator               m_elementNSAllocator;
00440 
00441     XalanSourceTreeProcessingInstructionAllocator   m_piAllocator;
00442 
00443     XalanSourceTreeTextAllocator                    m_textAllocator;
00444 
00445     XalanSourceTreeTextIWSAllocator                 m_textIWSAllocator;
00446 
00447     XalanDOMStringPool                              m_stringPool;
00448 
00449     XalanSourceTreeAttributesVector                 m_attributesVector;
00450 
00451     unsigned int                                    m_nextIndexValue;
00452 
00453     const bool                                      m_poolAllText;
00454 
00455     ElementByIDMapType                              m_elementsByID;
00456 
00457     UnparsedEntityURIMapType                        m_unparsedEntityURIs;
00458 
00459     StringCollectionType                            m_nonPooledStrings;
00460 
00461     static const XalanDOMString&                    s_nameString;
00462 };
00463 
00464 
00465 
00466 #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++ XSL Transformer Version 1.1
Copyright © 2000, 2001 The Apache Software Foundation. All Rights Reserved.