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  

ElemTemplateElement.hpp

Go to the documentation of this file.
00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  *
00005  * Copyright (c) 1999 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(XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD)
00058 #define XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD 
00059 
00060 
00061 
00062 // Base include file.  Must be first.
00063 #include <XSLT/XSLTDefinitions.hpp>
00064 
00065 
00066 
00067 #include <vector>
00068 #include <map>
00069 
00070 
00071 
00072 #include <XalanDOM/XalanDOMString.hpp>
00073 #include <XalanDOM/XalanElement.hpp>
00074 #include <XalanDOM/XalanEmptyNamedNodeMap.hpp>
00075 #include <XalanDOM/XalanNodeListSurrogate.hpp>
00076 
00077 
00078 
00079 #include <PlatformSupport/DOMStringHelper.hpp>
00080 
00081 
00082 
00083 #include <DOMSupport/PrefixResolver.hpp>
00084 
00085 
00086 
00087 #include <XSLT/NamespacesHandler.hpp>
00088 #include <XSLT/NodeSorter.hpp>
00089 
00090 
00091 
00092 class AttributeList;
00093 class NamespacesHandler;
00094 class NodeRefListBase;
00095 class QName;
00096 class Stylesheet;
00097 class StylesheetConstructionContext;
00098 class StylesheetExecutionContext;
00099 class XPath;
00100 
00101 
00102 
00103 class ElemTemplateElement : public XalanElement, public PrefixResolver
00104 {
00105 public:
00106 
00117     ElemTemplateElement(
00118             StylesheetConstructionContext&  constructionContext,
00119             Stylesheet&                     stylesheetTree,
00120             int                             lineNumber,
00121             int                             columnNumber,
00122             int                             xslToken);
00123 
00124     virtual
00125     ~ElemTemplateElement();
00126 
00136     virtual bool
00137     isAttrOK(
00138             int                     tok,
00139             const XalanDOMChar*     attrName,
00140             const AttributeList&    atts,
00141             int                     which) const;
00142 
00152     virtual bool
00153     isAttrOK(
00154             const XalanDOMChar*             attrName,
00155             const AttributeList&            atts,
00156             int                             which,
00157             StylesheetConstructionContext&  constructionContext) const;
00158 
00167     void
00168     processSpaceAttr(
00169             const AttributeList&    atts,
00170             int                     which);
00171 
00180     bool
00181     processSpaceAttr(
00182             const XalanDOMChar*     aname, 
00183             const AttributeList&    atts,
00184             int                     which);
00185 
00193     static bool
00194     isValidNCName(const XalanDOMString&     s);
00195 
00205     virtual void
00206     execute(
00207             StylesheetExecutionContext&     executionContext,
00208             XalanNode*                      sourceTree,
00209             XalanNode*                      sourceNode,
00210             const QName&                    mode) const;
00211 
00220     void
00221     executeChildren(
00222             StylesheetExecutionContext&     executionContext,
00223             XalanNode*                      sourceTree, 
00224             XalanNode*                      sourceNode,
00225             const QName&                    mode) const;
00226 
00237     void
00238     childrenToString(
00239             StylesheetExecutionContext&     executionContext, 
00240             XalanNode*                      sourceTree,
00241             XalanNode*                      sourceNode,
00242             const QName&                    mode,
00243             XalanDOMString&                 result) const;
00244 
00245 
00253     int
00254     getXSLToken() const
00255     {
00256         return m_xslToken;
00257     }
00258 
00265     static bool
00266     isWhitespace(const XalanDOMString& theString);
00267 
00274     virtual void
00275     error(const XalanDOMString&     msg) const;
00276 
00283     virtual void
00284     error(const char*   msg) const;
00285 
00291     int
00292     getLineNumber() const
00293     {
00294         return m_lineNumber;
00295     }
00296 
00302     int
00303     getColumnNumber() const
00304     {
00305         return m_columnNumber;
00306     }
00307 
00308     virtual const XalanDOMString&
00309     getElementName() const = 0;
00310 
00311 #if defined(XALAN_NO_NAMESPACES)
00312     typedef map<XalanDOMString,
00313                 XalanDOMString,
00314                 less<XalanDOMString> >  StringToStringMapType;
00315 #else
00316     typedef std::map<XalanDOMString,
00317                      XalanDOMString>    StringToStringMapType;
00318 #endif
00319 
00325     const NamespacesHandler&
00326     getNamespacesHandler() const
00327     {
00328         return m_namespacesHandler;
00329     }
00330 
00336     const Stylesheet&
00337     getStylesheet() const
00338     {
00339         return m_stylesheet;
00340     }
00341 
00345     void
00346     finishedConstruction()
00347     {
00348         m_finishedConstruction = true;
00349     }
00350 
00354     virtual void
00355     postConstruction(const NamespacesHandler&   theParentHandler);
00356 
00357     // Type-safe getters/setters...
00358 
00364     virtual ElemTemplateElement*
00365     getFirstChildElem() const;
00366 
00374     virtual void
00375     setFirstChildElem(ElemTemplateElement*  theChild);
00376 
00382     virtual ElemTemplateElement*
00383     getLastChildElem() const;
00384 
00390     virtual ElemTemplateElement*
00391     getNextSiblingElem() const;
00392 
00400     virtual void
00401     setNextSiblingElem(ElemTemplateElement*     theSibling);
00402 
00408     virtual ElemTemplateElement*
00409     getPreviousSiblingElem() const;
00410 
00418     virtual void
00419     setPreviousSiblingElem(ElemTemplateElement*     theSibling);
00420 
00426     virtual ElemTemplateElement*
00427     getParentNodeElem() const;
00428 
00436     virtual void
00437     setParentNodeElem(ElemTemplateElement*      theParent);
00438 
00446     virtual ElemTemplateElement*
00447     appendChildElem(ElemTemplateElement*    newChild);
00448 
00449     // Type-safe getters...
00450 
00459     virtual ElemTemplateElement*
00460     insertBeforeElem(
00461             ElemTemplateElement*    newChild,
00462             ElemTemplateElement*    refChild);
00463 
00472     virtual ElemTemplateElement*
00473     replaceChildElem(
00474             ElemTemplateElement*    newChild,
00475             ElemTemplateElement*    oldChild);
00476 
00477     // These interfaces are inherited from XalanElement ...
00478 
00479     virtual const XalanDOMString&
00480     getNodeName() const;
00481 
00482     virtual const XalanDOMString&
00483     getNodeValue() const;
00484 
00485     virtual NodeType
00486     getNodeType() const;
00487 
00488     virtual XalanNode*
00489     getParentNode() const;
00490 
00491     virtual const XalanNodeList*
00492     getChildNodes() const;
00493 
00494     virtual XalanNode*
00495     getFirstChild() const;
00496 
00497     virtual XalanNode*
00498     getLastChild() const;
00499 
00500     virtual XalanNode*
00501     getPreviousSibling() const;
00502 
00503     virtual XalanNode*
00504     getNextSibling() const;
00505 
00506     virtual const XalanNamedNodeMap*
00507     getAttributes() const;
00508 
00509     virtual XalanDocument*
00510     getOwnerDocument() const;
00511 
00512 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
00513     virtual XalanNode*
00514 #else
00515     virtual ElemTemplateElement*
00516 #endif
00517     cloneNode(bool  deep) const;
00518 
00519     virtual XalanNode*
00520     insertBefore(
00521             XalanNode*  newChild,
00522             XalanNode*  refChild);
00523 
00524     virtual XalanNode*
00525     replaceChild(
00526             XalanNode*  newChild,
00527             XalanNode*  oldChild);
00528 
00529     virtual XalanNode*
00530     removeChild(XalanNode*  oldChild);
00531 
00538     virtual XalanNode*
00539     appendChild(XalanNode*  newChild);
00540 
00541     virtual bool
00542     hasChildNodes() const;
00543 
00544     virtual void
00545     setNodeValue(const XalanDOMString&  nodeValue);
00546 
00547     virtual void
00548     normalize();
00549 
00550     virtual bool
00551     supports(
00552             const XalanDOMString&   feature,
00553             const XalanDOMString&   version) const;
00554 
00555     virtual const XalanDOMString&
00556     getNamespaceURI() const;
00557 
00558     virtual const XalanDOMString&
00559     getPrefix() const;
00560 
00561     virtual const XalanDOMString&
00562     getLocalName() const;
00563 
00564     virtual void
00565     setPrefix(const XalanDOMString& prefix);
00566 
00567     virtual bool
00568     isIndexed() const;
00569 
00570     virtual unsigned long
00571     getIndex() const;
00572 
00573     virtual const XalanDOMString&
00574     getTagName() const;
00575 
00576     virtual const XalanDOMString&
00577     getAttribute(const XalanDOMString&  name) const;
00578 
00579     virtual XalanAttr*
00580     getAttributeNode(const XalanDOMString&  name) const;
00581 
00582     virtual XalanNodeList*
00583     getElementsByTagName(const XalanDOMString&  name) const;
00584 
00585     virtual void
00586     setAttribute(
00587             const XalanDOMString&   name, 
00588             const XalanDOMString&   value);
00589 
00590     virtual XalanAttr*
00591     setAttributeNode(XalanAttr*     newAttr);
00592 
00593     virtual XalanAttr*
00594     removeAttributeNode(XalanAttr*  oldAttr);
00595 
00596     virtual void
00597     removeAttribute(const XalanDOMString&   name);
00598 
00599     virtual const XalanDOMString&
00600     getAttributeNS(
00601             const XalanDOMString&   namespaceURI,
00602             const XalanDOMString&   localName) const;
00603 
00604     virtual void
00605     setAttributeNS(
00606             const XalanDOMString&   namespaceURI,
00607             const XalanDOMString&   qualifiedName,
00608             const XalanDOMString&   value);
00609 
00610     virtual void
00611     removeAttributeNS(
00612             const XalanDOMString&   namespaceURI,
00613             const XalanDOMString&   localName);
00614 
00615     virtual XalanAttr*
00616     getAttributeNodeNS(
00617             const XalanDOMString&   namespaceURI,
00618             const XalanDOMString&   localName) const;
00619 
00620     virtual XalanAttr*
00621     setAttributeNodeNS(XalanAttr*   newAttr);
00622 
00623     virtual XalanNodeList*
00624     getElementsByTagNameNS(
00625             const XalanDOMString&   namespaceURI,
00626             const XalanDOMString&   localName) const;
00627 
00628 
00629     // These interfaces are inherited from PrefixResolver...
00630 
00631     virtual const XalanDOMString&
00632     getNamespaceForPrefix(const XalanDOMString& prefix) const;
00633 
00634     virtual const XalanDOMString&
00635     getURI() const;
00636 
00637 protected:
00638 
00646     const XalanDOMString&
00647     getNamespaceForPrefixInternal(
00648             const XalanDOMString&   prefix,
00649             bool                    fReportError) const;
00650 
00668     void
00669     transformSelectedChildren(
00670             StylesheetExecutionContext&     executionContext,
00671             const Stylesheet&               stylesheetTree,
00672             const ElemTemplateElement&      xslInstruction,
00673             const ElemTemplateElement*      theTemplate,
00674             XalanNode*                      sourceTree,
00675             XalanNode*                      sourceNodeContext,
00676             const QName&                    mode,
00677             const XPath*                    selectPattern,
00678             int                             xslToken,
00679             int                             selectStackFrameIndex) const;
00680 
00698     void
00699     doTransformSelectedChildren(
00700             StylesheetExecutionContext&                 executionContext,
00701             const Stylesheet&                           stylesheetTree,
00702             const ElemTemplateElement&                  xslInstruction,
00703             const ElemTemplateElement*                  theTemplate,
00704             XalanNode*                                  sourceTree,
00705             XalanNode*                                  sourceNodeContext,
00706             const QName&                                mode,
00707             int                                         xslToken,
00708             int                                         selectStackFrameIndex,
00709             const NodeSorter::NodeSortKeyVectorType&    keys,
00710             const NodeRefListBase&                      sourceNodes,
00711             unsigned int                                sourceNodesCount) const;
00712 
00730     void
00731     doTransformSelectedChildren(
00732             StylesheetExecutionContext&                 executionContext,
00733             const Stylesheet&                           stylesheetTree,
00734             const ElemTemplateElement&                  xslInstruction,
00735             const ElemTemplateElement*                  theTemplate,
00736             XalanNode*                                  sourceTree,
00737             XalanNode*                                  sourceNodeContext,
00738             const QName&                                mode,
00739             int                                         xslToken,
00740             int                                         selectStackFrameIndex,
00741             const NodeSorter::NodeSortKeyVectorType&    keys,
00742             const XalanNodeList&                        childNodes,
00743             unsigned int                                childNodeCount) const;
00744 
00745     void
00746     doTransformSelectedChildren(
00747             StylesheetExecutionContext&         executionContext,
00748             const Stylesheet&                   stylesheetTree,
00749             const ElemTemplateElement&          xslInstruction,
00750             const ElemTemplateElement*          theTemplate,
00751             XalanNode*                          sourceTree,
00752             XalanNode*                          sourceNodeContext,
00753             const QName&                        mode,
00754             int                                 xslToken,
00755             const NodeRefListBase&              sourceNodes,
00756             unsigned int                        sourceNodesCount) const;
00757 
00775     bool
00776     transformChild(
00777             StylesheetExecutionContext&     executionContext,
00778             const Stylesheet&               stylesheetTree,
00779             const ElemTemplateElement*      xslInstruction,
00780             const ElemTemplateElement*      theTemplate,
00781             XalanNode*                      sourceTree,
00782             XalanNode*                      selectContext,
00783             XalanNode*                      child,
00784             const QName&                    mode,
00785             int                             xslToken) const;
00786 
00799     virtual bool
00800     childTypeAllowed(int    xslToken) const;
00801 
00802 protected:
00803 
00804     bool                    m_finishedConstruction;
00805 
00806     /*
00807      * This object handles all result tree namespace processing.
00808      */
00809     NamespacesHandler       m_namespacesHandler;
00810 
00811     static const XalanDOMString     s_emptyString;
00812 
00813 private:
00814 
00815     Stylesheet&             m_stylesheet;
00816 
00817     const int               m_lineNumber;
00818     const int               m_columnNumber;
00819 
00820     bool                    m_defaultSpace;
00821 
00822     const int               m_xslToken;
00823 
00824     ElemTemplateElement*    m_parentNode;
00825     ElemTemplateElement*    m_nextSibling;
00826     ElemTemplateElement*    m_previousSibling;
00827     ElemTemplateElement*    m_firstChild;
00828 
00829     XalanNodeListSurrogate  m_surrogateChildren;
00830 
00831     XalanEmptyNamedNodeMap  m_fakeAttributes;
00832 
00833     const XalanDOMString    m_baseIndentifier;
00834 };
00835 
00836 
00837 
00838 #endif  // XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD

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.