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  

DOMServices.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(DOMSERVICES_HEADER_GUARD_1357924680)
00058 #define DOMSERVICES_HEADER_GUARD_1357924680
00059 
00060 
00061 
00062 // Base include file.  Must be first.
00063 #include <DOMSupport/DOMSupportDefinitions.hpp>
00064 
00065 
00066 
00067 #include <XalanDOM/XalanDOMString.hpp>
00068 #include <XalanDOM/XalanAttr.hpp>
00069 #include <XalanDOM/XalanComment.hpp>
00070 #include <XalanDOM/XalanDocument.hpp>
00071 #include <XalanDOM/XalanElement.hpp>
00072 #include <XalanDOM/XalanProcessingInstruction.hpp>
00073 #include <XalanDOM/XalanText.hpp>
00074 
00075 
00076 
00077 #include <PlatformSupport/DOMStringHelper.hpp>
00078 
00079 
00080 
00081 class XalanDocument;
00082 class XalanDocumentFragment;
00083 
00084 
00085 
00086 class XALAN_DOMSUPPORT_EXPORT DOMServices
00087 {
00088 public:
00089 
00090     static const XalanDOMString&    s_XMLString;
00091     static const XalanDOMString&    s_XMLStringWithSeparator;
00092     static const XalanDOMString&    s_XMLNamespaceURI;
00093     static const XalanDOMString&    s_XMLNamespace;
00094     static const XalanDOMString&    s_XMLNamespaceWithSeparator;
00095     static const XalanDOMString&    s_XMLNamespaceSeparatorString;
00096 
00097     static const unsigned int&      s_XMLStringLength;
00098     static const unsigned int&      s_XMLStringWithSeparatorLength;
00099     static const unsigned int&      s_XMLNamespaceURILength;
00100     static const unsigned int&      s_XMLNamespaceLength;
00101     static const unsigned int&      s_XMLNamespaceWithSeparatorLength;
00102     static const unsigned int&      s_XMLNamespaceSeparatorStringLength;
00103 
00104     // A dummy string to return when we need an emtpy string...
00105     static const XalanDOMString     s_emptyString;
00106 
00107 
00108     class XALAN_DOMSUPPORT_EXPORT WhitespaceSupport
00109     {
00110     public:
00111 
00112         WhitespaceSupport();
00113 
00114         virtual
00115         ~WhitespaceSupport();
00116 
00124         virtual bool
00125         isIgnorableWhitespace(const XalanText&  node) const = 0;
00126     };
00127 
00128     // A default implementation using the values from the XML spec.
00129     class XALAN_DOMSUPPORT_EXPORT WhitespaceSupportDefault : public WhitespaceSupport
00130     {
00131     public:
00132 
00133         WhitespaceSupportDefault();
00134 
00135         virtual
00136         ~WhitespaceSupportDefault();
00137 
00145         virtual bool
00146         isIgnorableWhitespace(const XalanText&  node) const;
00147     };
00148 
00153     static void
00154     initialize();
00155 
00160     static void
00161     terminate();
00162 
00169     static XalanDOMString
00170     getNodeData(const XalanNode&    node);
00171 
00178     static void
00179     getNodeData(
00180             const XalanNode&    node,
00181             XalanDOMString&     data);
00182 
00189     static XalanDOMString
00190     getNodeData(const XalanAttr&    attribute)
00191     {
00192         return attribute.getNodeValue();
00193     }
00194 
00201     static void
00202     getNodeData(
00203             const XalanAttr&    attribute,
00204             XalanDOMString&     data)
00205     {
00206         append(data, attribute.getNodeValue());
00207     }
00208 
00215     static XalanDOMString
00216     getNodeData(const XalanComment&     comment)
00217     {
00218         return comment.getData();
00219     }
00220 
00227     static void
00228     getNodeData(
00229             const XalanComment&     comment,
00230             XalanDOMString&         data)
00231     {
00232         append(data, comment.getData());
00233     }
00234 
00241     static XalanDOMString
00242     getNodeData(const XalanDocument&    document);
00243 
00250     static void
00251     getNodeData(
00252             const XalanDocument&    document,
00253             XalanDOMString&         data);
00254 
00261     static XalanDOMString
00262     getNodeData(const XalanDocumentFragment&    documentFragment);
00263 
00270     static void
00271     getNodeData(
00272             const XalanDocumentFragment&    documentFragment,
00273             XalanDOMString&                 data);
00274 
00281     static XalanDOMString
00282     getNodeData(const XalanElement&     element);
00283 
00290     static void
00291     getNodeData(
00292             const XalanElement&     element,
00293             XalanDOMString&         data);
00294 
00301     static XalanDOMString
00302     getNodeData(const XalanProcessingInstruction&   pi)
00303     {
00304         return pi.getData();
00305     }
00306 
00313     static void
00314     getNodeData(
00315             const XalanProcessingInstruction&   pi,
00316             XalanDOMString&                     data)
00317     {
00318         append(data, pi.getData());
00319     }
00320 
00327     static XalanDOMString
00328     getNodeData(const XalanText&    text)
00329     {
00330         return text.getData();
00331     }
00332 
00339     static void
00340     getNodeData(
00341             const XalanText&    text,
00342             XalanDOMString&     data)
00343     {
00344         append(data, text.getData());
00345     }
00346 
00355     static const XalanDOMString&
00356     getNameOfNode(const XalanNode&  n);
00357 
00366     static const XalanDOMString&
00367     getLocalNameOfNode(const XalanNode&     n)
00368     {
00369         const XalanDOMString&   theLocalName = n.getLocalName();
00370 
00371         if (length(theLocalName) != 0)
00372         {
00373             return theLocalName;
00374         }
00375         else
00376         {
00377             assert(length(n.getNodeName()) != 0);
00378 
00379             return n.getNodeName();
00380         }
00381     }
00382 
00391     static const XalanDOMString&
00392     getNamespaceOfNode(const XalanNode& n);
00393 
00401     static XalanNode*
00402     getParentOfNode(const XalanNode&    node)
00403     {
00404         if(node.getNodeType() == XalanNode::ATTRIBUTE_NODE)
00405         {
00406 #if defined(XALAN_OLD_STYLE_CASTS)
00407             return findOwnerElement((const XalanAttr&)node);
00408 #else
00409             return findOwnerElement(static_cast<const XalanAttr&>(node));
00410 #endif
00411         }
00412         else
00413         {
00414             return node.getParentNode();
00415         }
00416     }
00417 
00425     static const XalanDOMString&
00426     getNamespaceForPrefix(
00427             const XalanDOMString&   prefix,
00428             const XalanElement&     namespaceContext);
00429 
00437     static bool
00438     isNodeAfter(
00439             const XalanNode&    node1,
00440             const XalanNode&    node2);
00441 
00450     static bool
00451     isNodeAfterSibling(
00452             const XalanNode&    parent,
00453             const XalanNode&    child1,
00454             const XalanNode&    child2);
00455 
00456 private:
00457 
00466     static XalanNode*
00467     findOwnerElement(const XalanAttr&   attr)
00468     {
00469         XalanNode* const    theOwnerElement = attr.getOwnerElement();
00470 
00471         if (theOwnerElement != 0)
00472         {
00473             return theOwnerElement;
00474         }
00475         else
00476         {
00477             return findOwnerElement(attr, *attr.getOwnerDocument()->getDocumentElement());
00478         }
00479     }
00480 
00490     static XalanNode*
00491     findOwnerElement(
00492             const XalanNode&    attr,
00493             XalanNode&          element);
00494 
00495 };
00496 
00497 
00498 
00499 #endif  // DOMSERVICES_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.