## 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

# XalanSourceTreeContentHandler.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(XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680)
    00018 #define XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680
    00019
    00020
    00021
    00022 #include <xalanc/XalanSourceTree/XalanSourceTreeDefinitions.hpp>
    00023
    00024
    00025
    00026 #include <xalanc/Include/XalanVector.hpp>
    00027
    00028
    00029
    00030 #include <xercesc/sax/DocumentHandler.hpp>
    00031 #include <xercesc/sax/DTDHandler.hpp>
    00032 #include <xercesc/sax2/ContentHandler.hpp>
    00033 #include <xercesc/sax2/LexicalHandler.hpp>
    00034
    00035
    00036
    00037 #include <xalanc/XalanDOM/XalanDOMString.hpp>
    00038
    00039
    00040
    00041 XALAN_DECLARE_XERCES_CLASS(Attributes)
    00042 XALAN_DECLARE_XERCES_CLASS(AttributeList)
    00043 XALAN_DECLARE_XERCES_CLASS(ContentHandler)
    00044 XALAN_DECLARE_XERCES_CLASS(DTDHandler)
    00045 XALAN_DECLARE_XERCES_CLASS(LexicalHandler)
    00046 XALAN_DECLARE_XERCES_CLASS(Locator)
    00047
    00048
    00049
    00050 XALAN_CPP_NAMESPACE_BEGIN
    00051
    00052
    00053
    00054 typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes       AttributesType;
    00055 typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList    AttributeListType;
    00056 typedef XERCES_CPP_NAMESPACE_QUALIFIER ContentHandler   ContentHandlerType;
    00057 typedef XERCES_CPP_NAMESPACE_QUALIFIER DTDHandler       DTDHandlerType;
    00058 typedef XERCES_CPP_NAMESPACE_QUALIFIER LexicalHandler   LexicalHandlerType;
    00059 typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator          LocatorType;
    00060
    00061
    00062
    00063 class XalanNode;
    00064 class XalanSourceTreeDocument;
    00065 class XalanSourceTreeElement;
    00066
    00067
    00068
    00069 class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeContentHandler :
    00070     public ContentHandlerType,
    00071     public DTDHandlerType,
    00072     public LexicalHandlerType
    00073 {
    00074 public:
    00075
    00076     typedef XalanVector<XalanSourceTreeElement*>        ElementStackType;
    00077     typedef XalanVector<XalanNode*>                         LastChildStackType;
    00078
    00079     enum { eDefaultStackSize = 50, eDefaultTextBufferSize = 100 };
    00080
    00081
    00082     // Constructor
    00083     explicit
    00084     XalanSourceTreeContentHandler(
    00085             MemoryManagerType&          theManager,
    00086             XalanSourceTreeDocument*    theDocument = 0,
    00087             bool                        fAccumulateText = true);
    00088
    00089     virtual
    00090     ~XalanSourceTreeContentHandler();
    00091
    00092
    00093     // Inherited from ContentHandler...
    00094     virtual void
    00095     characters(
    00096             const XMLCh* const  chars,
    00097             const unsigned int  length);
    00098
    00099     virtual void
    00100     endDocument();
    00101
    00102     virtual void
    00103     endElement(
    00104             const XMLCh* const  uri,
    00105             const XMLCh* const  localname,
    00106             const XMLCh* const  qname);
    00107
    00108     virtual void
    00109     ignorableWhitespace(
    00110             const XMLCh* const  chars,
    00111             const unsigned int  length);
    00112
    00113     virtual void
    00114     processingInstruction(
    00115         const XMLCh* const  target,
    00116         const XMLCh* const  data);
    00117
    00118     virtual void
    00119     setDocumentLocator(const LocatorType* const     locator);
    00120
    00121     virtual void
    00122     startDocument();
    00123
    00124     virtual void
    00125     startElement(
    00126             const XMLCh* const      uri,
    00127             const XMLCh* const      localname,
    00128             const XMLCh* const      qname,
    00129             const AttributesType&   attrs);
    00130
    00131     virtual void
    00132     startPrefixMapping(
    00133         const XMLCh* const  prefix,
    00134         const XMLCh* const  uri);
    00135
    00136     virtual void
    00137     endPrefixMapping(const XMLCh* const     prefix);
    00138
    00139
    00140     virtual void
    00141     skippedEntity(const XMLCh* const    name);
    00142
    00143
    00144     // Inherited from DTDHandler...
    00145
    00146     virtual void
    00147     notationDecl(
    00148             const XMLCh* const    name,
    00149             const XMLCh* const    publicId,
    00150             const XMLCh* const    systemId);
    00151
    00152     virtual void
    00153     unparsedEntityDecl(
    00154             const XMLCh* const    name,
    00155             const XMLCh* const    publicId,
    00156             const XMLCh* const    systemId,
    00157             const XMLCh* const    notationName);
    00158
    00159     virtual void
    00160     resetDocType();
    00161
    00162
    00163     // Inherited from LexicalHandler...
    00164
    00165     virtual void
    00166     comment(
    00167             const XMLCh* const  chars,
    00168             const unsigned int  length);
    00169
    00170     virtual void
    00171     endCDATA();
    00172
    00173     virtual void
    00174     endDTD();
    00175
    00176     virtual void
    00177     endEntity(const XMLCh* const    name);
    00178
    00179     virtual void
    00180     startCDATA();
    00181
    00182     virtual void
    00183     startDTD(
    00184             const XMLCh* const  name,
    00185             const XMLCh* const  publicId,
    00186             const XMLCh* const  systemId);
    00187
    00188     virtual void
    00189     startEntity(const XMLCh* const  name);
    00190
    00191
    00192     // New to XalanSourceTreeContentHandler...
    00193
    00194     XalanSourceTreeDocument*
    00195     getDocument() const
    00196     {
    00197         return m_document;
    00198     }
    00199
    00200     void
    00201     setDocument(XalanSourceTreeDocument*    theDocument);
    00202
    00203 private:
    00204
    00205     // Not implemented...
    00206     XalanSourceTreeContentHandler(const XalanSourceTreeContentHandler&);
    00207
    00208     XalanSourceTreeContentHandler&
    00209     operator=(const XalanSourceTreeContentHandler&);
    00210
    00211     bool
    00212     operator==(const XalanSourceTreeContentHandler&) const;
    00213
    00214     // Helper functions...
    00215     XalanSourceTreeElement*
    00216     createElement(
    00217             const XMLCh* const          uri,
    00218             const XMLCh* const          localname,
    00219             const XMLCh* const          qname,
    00220             const AttributesType&       attrs,
    00221             XalanSourceTreeElement*     theOwnerElement);
    00222
    00223     void
    00224     processAccumulatedText();
    00225
    00226     void
    00227     doCharacters(
    00228             const XMLCh*                chars,
    00229             XalanDOMString::size_type   length);
    00230
    00231     // Data members...
    00232
    00233     // The current document we're building...
    00234     XalanSourceTreeDocument*    m_document;
    00235
    00236     // The current element...
    00237     XalanSourceTreeElement*     m_currentElement;
    00238
    00239     // Stack of elements...
    00240     ElementStackType            m_elementStack;
    00241
    00242     // The last child appended to the current element.  This is
    00243     // an important optimization, because XalanSourceTreeElement
    00244     // does not have a pointer to its last child.  Without this,
    00245     // appending a child becomes a linear search.
    00246     XalanNode*                  m_lastChild;
    00247
    00248     // Stack of last children appended.  There is a ono-to-one
    00249     // correspondance to the entries in m_elementStack.
    00250     LastChildStackType          m_lastChildStack;
    00251
    00252     // If true, the handler will accumulate text from calls to
    00253     // characters() until another event triggers the creation
    00254     // of the node.
    00255     const bool                  m_accumulateText;
    00256
    00257     // A buffer to hold accumulated text.
    00258     XalanDOMString              m_textBuffer;
    00259
    00260     // A flag to determine if the DTD is being processed.
    00261     bool                        m_inDTD;
    00262 };
    00263
    00264
    00265
    00266 XALAN_CPP_NAMESPACE_END
    00267
    00268
    00269
    00270 #endif  // #if !defined(XALANSOURCETREECONTENTHANDLER_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.10 Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.