Xalan-C++ API Documentation

The Xalan-C++ XSL Transformer Version 1.0

Main Page   Namespace List   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 <XPath/PrefixResolver.hpp>
00084 
00085 
00086 
00087 #include <XSLT/NodeSorter.hpp>
00088 
00089 
00090 
00091 class AttributeList;
00092 class NamespacesHandler;
00093 class NodeRefListBase;
00094 class QName;
00095 class Stylesheet;
00096 class StylesheetConstructionContext;
00097 class StylesheetExecutionContext;
00098 class XPath;
00099 
00100 
00109 
00110 class ElemTemplateElement : public XalanElement, public PrefixResolver
00111 {
00112 public:
00124     ElemTemplateElement(
00125             StylesheetConstructionContext&  constructionContext,
00126             Stylesheet&                     stylesheetTree,
00127             const XalanDOMString&           name,
00128             int                             lineNumber,
00129             int                             columnNumber,
00130             int                             xslToken);
00131 
00132     virtual
00133     ~ElemTemplateElement();
00134 
00144     virtual bool
00145     isAttrOK(
00146             int                     tok,
00147             const XalanDOMChar*     attrName,
00148             const AttributeList&    atts,
00149             int                     which) const;
00150 
00160     virtual bool
00161     isAttrOK(
00162             const XalanDOMChar*             attrName,
00163             const AttributeList&            atts,
00164             int                             which,
00165             StylesheetConstructionContext&  constructionContext) const;
00166 
00175     void
00176     processSpaceAttr(
00177             const AttributeList&    atts,
00178             int                     which);
00179 
00188     bool
00189     processSpaceAttr(
00190             const XalanDOMChar*     aname, 
00191             const AttributeList&    atts,
00192             int                     which);
00193 
00201     static bool
00202     isValidNCName(const XalanDOMString&     s);
00203 
00213     virtual void
00214     execute(
00215             StylesheetExecutionContext&     executionContext,
00216             XalanNode*                      sourceTree,
00217             XalanNode*                      sourceNode,
00218             const QName&                    mode) const;
00219 
00228     void
00229     executeChildren(
00230             StylesheetExecutionContext&     executionContext,
00231             XalanNode*                      sourceTree, 
00232             XalanNode*                      sourceNode,
00233             const QName&                    mode) const;
00234 
00245     XalanDOMString
00246     childrenToString(
00247             StylesheetExecutionContext&     executionContext, 
00248             XalanNode*                      sourceTree,
00249             XalanNode*                      sourceNode,
00250             const QName&                    mode) const;
00251 
00252 
00260     int
00261     getXSLToken() const
00262     {
00263         return m_xslToken;
00264     }
00265 
00272     static bool
00273     isWhiteSpace(const XalanDOMString& theString);
00274 
00281     virtual void
00282     error(const XalanDOMString&     msg) const;
00283 
00289     int
00290     getLineNumber() const
00291     {
00292         return m_lineNumber;
00293     }
00294 
00300     int
00301     getColumnNumber() const
00302     {
00303         return m_columnNumber;
00304     }
00305 
00306     const XalanDOMString
00307     getElementName() const
00308     {
00309         return m_elemName;
00310     }
00311 
00312 #if defined(XALAN_NO_NAMESPACES)
00313     typedef map<XalanDOMString,
00314                 XalanDOMString,
00315                 less<XalanDOMString> >  StringToStringMapType;
00316 #else
00317     typedef std::map<XalanDOMString,
00318                      XalanDOMString>    StringToStringMapType;
00319 #endif
00320 
00326     virtual const NamespacesHandler&
00327     getNamespacesHandler() const;
00328 
00334     const Stylesheet&
00335     getStylesheet() const
00336     {
00337         return m_stylesheet;
00338     }
00339 
00343     void
00344     finishedConstruction()
00345     {
00346         m_finishedConstruction = true;
00347     }
00348 
00352     virtual void
00353     postConstruction(const NamespacesHandler&   theParentHandler);
00354 
00355     // Type-safe getters/setters...
00356 
00362     virtual ElemTemplateElement*
00363     getFirstChildElem() const;
00364 
00372     virtual void
00373     setFirstChildElem(ElemTemplateElement*  theChild);
00374 
00380     virtual ElemTemplateElement*
00381     getLastChildElem() const;
00382 
00388     virtual ElemTemplateElement*
00389     getNextSiblingElem() const;
00390 
00398     virtual void
00399     setNextSiblingElem(ElemTemplateElement*     theSibling);
00400 
00406     virtual ElemTemplateElement*
00407     getPreviousSiblingElem() const;
00408 
00416     virtual void
00417     setPreviousSiblingElem(ElemTemplateElement*     theSibling);
00418 
00424     virtual ElemTemplateElement*
00425     getParentNodeElem() const;
00426 
00434     virtual void
00435     setParentNodeElem(ElemTemplateElement*      theParent);
00436 
00444     virtual ElemTemplateElement*
00445     appendChildElem(ElemTemplateElement*    newChild);
00446 
00447     // Type-safe getters...
00448 
00457     virtual ElemTemplateElement*
00458     insertBeforeElem(
00459             ElemTemplateElement*    newChild,
00460             ElemTemplateElement*    refChild);
00461 
00470     virtual ElemTemplateElement*
00471     replaceChildElem(
00472             ElemTemplateElement*    newChild,
00473             ElemTemplateElement*    oldChild);
00474 
00475     // These interfaces are inherited from XalanElement ...
00476 
00477     virtual XalanDOMString
00478     getNodeName() const;
00479 
00480     virtual XalanDOMString
00481     getNodeValue() const;
00482 
00483     virtual NodeType
00484     getNodeType() const;
00485 
00486     virtual XalanNode*
00487     getParentNode() const;
00488 
00489     virtual const XalanNodeList*
00490     getChildNodes() const;
00491 
00492     virtual XalanNode*
00493     getFirstChild() const;
00494 
00495     virtual XalanNode*
00496     getLastChild() const;
00497 
00498     virtual XalanNode*
00499     getPreviousSibling() const;
00500 
00501     virtual XalanNode*
00502     getNextSibling() const;
00503 
00504     virtual const XalanNamedNodeMap*
00505     getAttributes() const;
00506 
00507     virtual XalanDocument*
00508     getOwnerDocument() const;
00509 
00510 #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
00511     virtual XalanNode*
00512 #else
00513     virtual ElemTemplateElement*
00514 #endif
00515     cloneNode(bool  deep) const;
00516 
00517     virtual XalanNode*
00518     insertBefore(
00519             XalanNode*  newChild,
00520             XalanNode*  refChild);
00521 
00522     virtual XalanNode*
00523     replaceChild(
00524             XalanNode*  newChild,
00525             XalanNode*  oldChild);
00526 
00527     virtual XalanNode*
00528     removeChild(XalanNode*  oldChild);
00529 
00536     virtual XalanNode*
00537     appendChild(XalanNode*  newChild);
00538 
00539     virtual bool
00540     hasChildNodes() const;
00541 
00542     virtual void
00543     setNodeValue(const XalanDOMString&  nodeValue);
00544 
00545     virtual void
00546     normalize();
00547 
00548     virtual bool
00549     supports(
00550             const XalanDOMString&   feature,
00551             const XalanDOMString&   version) const;
00552 
00553     virtual XalanDOMString
00554     getNamespaceURI() const;
00555 
00556     virtual XalanDOMString
00557     getPrefix() const;
00558 
00559     virtual XalanDOMString
00560     getLocalName() const;
00561 
00562     virtual void
00563     setPrefix(const XalanDOMString& prefix);
00564 
00565     virtual bool
00566     isIndexed() const;
00567 
00568     virtual unsigned long
00569     getIndex() const;
00570 
00571     virtual XalanDOMString
00572     getXSLTData() const;
00573 
00574     virtual XalanDOMString
00575     getTagName() const;
00576 
00577     virtual XalanDOMString
00578     getAttribute(const XalanDOMString&  name) const;
00579 
00580     virtual XalanAttr*
00581     getAttributeNode(const XalanDOMString&  name) const;
00582 
00583     virtual XalanNodeList*
00584     getElementsByTagName(const XalanDOMString&  name) const;
00585 
00586     virtual void
00587     setAttribute(
00588             const XalanDOMString&   name, 
00589             const XalanDOMString&   value);
00590 
00591     virtual XalanAttr*
00592     setAttributeNode(XalanAttr*     newAttr);
00593 
00594     virtual XalanAttr*
00595     removeAttributeNode(XalanAttr*  oldAttr);
00596 
00597     virtual void
00598     removeAttribute(const XalanDOMString&   name);
00599 
00600     virtual XalanDOMString
00601     getAttributeNS(
00602             const XalanDOMString&   namespaceURI,
00603             const XalanDOMString&   localName) const;
00604 
00605     virtual void
00606     setAttributeNS(
00607             const XalanDOMString&   namespaceURI,
00608             const XalanDOMString&   qualifiedName,
00609             const XalanDOMString&   value);
00610 
00611     virtual void
00612     removeAttributeNS(
00613             const XalanDOMString&   namespaceURI,
00614             const XalanDOMString&   localName);
00615 
00616     virtual XalanAttr*
00617     getAttributeNodeNS(
00618             const XalanDOMString&   namespaceURI,
00619             const XalanDOMString&   localName) const;
00620 
00621     virtual XalanAttr*
00622     setAttributeNodeNS(XalanAttr*   newAttr);
00623 
00624     virtual XalanNodeList*
00625     getElementsByTagNameNS(
00626             const XalanDOMString&   namespaceURI,
00627             const XalanDOMString&   localName) const;
00628 
00629 
00630     // These interfaces are inherited from PrefixResolver...
00631 
00632     virtual XalanDOMString
00633     getNamespaceForPrefix(const XalanDOMString& prefix) const;
00634 
00635     virtual XalanDOMString
00636     getURI() const;
00637 
00638 protected:
00639 
00647     XalanDOMString
00648     getNamespaceForPrefixInternal(
00649             const XalanDOMString&   prefix,
00650             bool                    fReportError) const;
00651 
00669     void
00670     transformSelectedChildren(
00671             StylesheetExecutionContext&     executionContext,
00672             const Stylesheet&               stylesheetTree,
00673             const ElemTemplateElement&      xslInstruction,
00674             const ElemTemplateElement*      theTemplate,
00675             XalanNode*                      sourceTree,
00676             XalanNode*                      sourceNodeContext,
00677             const QName&                    mode,
00678             const XPath*                    selectPattern,
00679             int                             xslToken,
00680             int                             selectStackFrameIndex) const;
00681 
00699     void
00700     doTransformSelectedChildren(
00701             StylesheetExecutionContext&                 executionContext,
00702             const Stylesheet&                           stylesheetTree,
00703             const ElemTemplateElement&                  xslInstruction,
00704             const ElemTemplateElement*                  theTemplate,
00705             XalanNode*                                  sourceTree,
00706             XalanNode*                                  sourceNodeContext,
00707             const QName&                                mode,
00708             int                                         xslToken,
00709             int                                         selectStackFrameIndex,
00710             const NodeSorter::NodeSortKeyVectorType&    keys,
00711             const NodeRefListBase&                      sourceNodes,
00712             unsigned int                                sourceNodesCount) const;
00713 
00731     void
00732     doTransformSelectedChildren(
00733             StylesheetExecutionContext&                 executionContext,
00734             const Stylesheet&                           stylesheetTree,
00735             const ElemTemplateElement&                  xslInstruction,
00736             const ElemTemplateElement*                  theTemplate,
00737             XalanNode*                                  sourceTree,
00738             XalanNode*                                  sourceNodeContext,
00739             const QName&                                mode,
00740             int                                         xslToken,
00741             int                                         selectStackFrameIndex,
00742             const NodeSorter::NodeSortKeyVectorType&    keys,
00743             const XalanNodeList&                        childNodes,
00744             unsigned int                                childNodeCount) const;
00745 
00746     void
00747     doTransformSelectedChildren(
00748             StylesheetExecutionContext&         executionContext,
00749             const Stylesheet&                   stylesheetTree,
00750             const ElemTemplateElement&          xslInstruction,
00751             const ElemTemplateElement*          theTemplate,
00752             XalanNode*                          sourceTree,
00753             XalanNode*                          sourceNodeContext,
00754             const QName&                        mode,
00755             int                                 xslToken,
00756             const NodeRefListBase&              sourceNodes,
00757             unsigned int                        sourceNodesCount) const;
00758 
00776     bool
00777     transformChild(
00778             StylesheetExecutionContext&     executionContext,
00779             const Stylesheet&               stylesheetTree,
00780             const ElemTemplateElement*      xslInstruction,
00781             const ElemTemplateElement*      theTemplate,
00782             XalanNode*                      sourceTree,
00783             XalanNode*                      selectContext,
00784             XalanNode*                      child,
00785             const QName&                    mode,
00786             int                             xslToken) const;
00787 
00800     virtual bool
00801     childTypeAllowed(int    xslToken) const;
00802 
00803 protected:
00804 
00805     bool                    m_finishedConstruction;
00806 
00807 private:
00808 
00809     Stylesheet&             m_stylesheet;
00810 
00811     const int               m_lineNumber;
00812     const int               m_columnNumber;
00813 
00814     bool                    m_defaultSpace;
00815     const XalanDOMString    m_elemName;
00816 
00817     const int               m_xslToken;
00818 
00819     ElemTemplateElement*    m_parentNode;
00820     ElemTemplateElement*    m_nextSibling;
00821     ElemTemplateElement*    m_previousSibling;
00822     ElemTemplateElement*    m_firstChild;
00823 
00824     XalanNodeListSurrogate  m_surrogateChildren;
00825 
00826     XalanEmptyNamedNodeMap  m_fakeAttributes;
00827 
00828     const XalanDOMString    m_baseIndentifier;
00829 };
00830 
00831 
00832 
00833 #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.0
Copyright © 2000 The Apache Software Foundation. All Rights Reserved.