cvs commit: xml-xalan/c/src/XalanSourceTree XalanSourceTreeCDATASectionAllocator.cpp XalanSourceTreeCDATASectionAllocator.hpp XalanSourceTreeCDATASectionIWS.cpp XalanSourceTreeCDATASectionIWS.hpp XalanSourceTreeCDATASectionIWSAllocator.cpp XalanSourceTreeCDATASectionIWSAllocator.hpp XalanSourceTreeComment.cpp XalanSourceTreeComment.hpp XalanSourceTreeCommentAllocator.cpp XalanSourceTreeCommentAllocator.hpp XalanSourceTreeContentHandler.cpp XalanSourceTreeContentHandler.hpp XalanSourceTreeDefinitions.hpp XalanSourceTreeDocument.cpp XalanSourceTreeDocument.hpp XalanSourceTreeDOMSupport.cpp XalanSourceTreeDOMSupport.hpp XalanSourceTreeElement.cpp XalanSourceTreeElement.hpp XalanSourceTreeElementAllocator.cpp XalanSourceTreeElementAllocator.hpp XalanSourceTreeElementNS.cpp XalanSourceTreeElementNS.hpp XalanSourceTreeElementNSAllocator.cpp XalanSourceTreeElementNSAllocator.hpp XalanSourceTreeHelper.cpp XalanSourceTreeHelper.hpp XalanSourceTreeInit.cpp XalanSourceTreeInit.hpp XalanSourceTreeNamedNodeMap.cpp XalanSourceTreeNamedNodeMap.hpp XalanSourceTreeParserLiaison.cpp XalanSourceTreeParserLiaison.hpp XalanSourceTreeProcessingInstruction.cpp XalanSourceTreeProcessingInstruction.hpp XalanSourceTreeProcessingInstructionAllocator.cpp XalanSourceTreeProcessingInstructionAllocator.hpp XalanSourceTreeText.cpp XalanSourceTreeText.hpp XalanSourceTreeTextAllocator.cpp XalanSourceTreeTextAllocator.hpp XalanSourceTreeTextIWS.cpp XalanSourceTreeTextIWS.hpp XalanSourceTreeTextIWSAllocator.cpp XalanSourceTreeTextIWSAllocator.hpp

15 Dec 2000 23:24:15 -0000

dbertoni    00/12/15 15:24:15

  Added:       c/src/XalanSourceTree
                        XalanSourceTreeCDATASectionAllocator.cpp
                        XalanSourceTreeCDATASectionAllocator.hpp
                        XalanSourceTreeCDATASectionIWS.cpp
                        XalanSourceTreeCDATASectionIWS.hpp
                        XalanSourceTreeCDATASectionIWSAllocator.cpp
                        XalanSourceTreeCDATASectionIWSAllocator.hpp
                        XalanSourceTreeComment.cpp
                        XalanSourceTreeComment.hpp
                        XalanSourceTreeCommentAllocator.cpp
                        XalanSourceTreeCommentAllocator.hpp
                        XalanSourceTreeContentHandler.cpp
                        XalanSourceTreeContentHandler.hpp
                        XalanSourceTreeDefinitions.hpp
                        XalanSourceTreeDocument.cpp
                        XalanSourceTreeDocument.hpp
                        XalanSourceTreeDOMSupport.cpp
                        XalanSourceTreeDOMSupport.hpp
                        XalanSourceTreeElement.cpp
                        XalanSourceTreeElement.hpp
                        XalanSourceTreeElementAllocator.cpp
                        XalanSourceTreeElementAllocator.hpp
                        XalanSourceTreeElementNS.cpp
                        XalanSourceTreeElementNS.hpp
                        XalanSourceTreeElementNSAllocator.cpp
                        XalanSourceTreeElementNSAllocator.hpp
                        XalanSourceTreeHelper.cpp XalanSourceTreeHelper.hpp
                        XalanSourceTreeInit.cpp XalanSourceTreeInit.hpp
                        XalanSourceTreeNamedNodeMap.cpp
                        XalanSourceTreeNamedNodeMap.hpp
                        XalanSourceTreeParserLiaison.cpp
                        XalanSourceTreeParserLiaison.hpp
                        XalanSourceTreeProcessingInstruction.cpp
                        XalanSourceTreeProcessingInstruction.hpp
                        XalanSourceTreeProcessingInstructionAllocator.cpp
                        XalanSourceTreeProcessingInstructionAllocator.hpp
                        XalanSourceTreeText.cpp XalanSourceTreeText.hpp
                        XalanSourceTreeTextAllocator.cpp
                        XalanSourceTreeTextAllocator.hpp
                        XalanSourceTreeTextIWS.cpp
                        XalanSourceTreeTextIWS.hpp
                        XalanSourceTreeTextIWSAllocator.cpp
                        XalanSourceTreeTextIWSAllocator.hpp
  Log:
  Initial revision.
  
  Revision  Changes    Path
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeCDATASectionAllocator.cpp
  
  Index: XalanSourceTreeCDATASectionAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanSourceTreeCDATASectionAllocator.hpp"
  
  
  
  
XalanSourceTreeCDATASectionAllocator::XalanSourceTreeCDATASectionAllocator(size_type
  theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanSourceTreeCDATASectionAllocator::~XalanSourceTreeCDATASectionAllocator()
  {
  }
  
  
  
  XalanSourceTreeCDATASectionAllocator::ObjectType*
  XalanSourceTreeCDATASectionAllocator::create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex)
  {
        ObjectType* const       theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        new(theBlock) ObjectType(
                                                theData,
                                                theParentElement,
                                                thePreviousSibling,
                                                theNextSibling,
                                                theIndex);
  
        m_allocator.commitAllocation(theBlock);
  
        return theBlock;
  }
  
  
  
  void 
  XalanSourceTreeCDATASectionAllocator::reset()
  {
        m_allocator.reset();
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeCDATASectionAllocator.hpp
  
  Index: XalanSourceTreeCDATASectionAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREECDATASECTIONALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANSOURCETREECDATASECTIONALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeCDATASection.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeCDATASectionAllocator
  {
  public:
  
        typedef XalanSourceTreeCDATASection                             
ObjectType;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<ObjectType>                                  
ArenaBlockType;
  
        typedef ArenaAllocator<ObjectType,
                                                   ArenaBlockType>              
        ArenaAllocatorType;
  #else
        typedef ArenaAllocator<ObjectType>                              
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type                   size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanSourceTreeCDATASectionAllocator(size_type  theBlockCount);
  
        ~XalanSourceTreeCDATASectionAllocator();
  
        /**
         * Create an instance.
         * 
         * @param theData The data for the node
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The next sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        ObjectType*
        create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        /**
         * Delete all objects from allocator.    
         */     
        void
        reset();
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanSourceTreeCDATASectionAllocator(const 
XalanSourceTreeCDATASectionAllocator&);
  
        XalanSourceTreeCDATASectionAllocator&
        operator=(const XalanSourceTreeCDATASectionAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANSOURCETREECOMMENTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeCDATASectionIWS.cpp
  
  Index: XalanSourceTreeCDATASectionIWS.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeCDATASectionIWS.hpp"
  
  
  
  XalanSourceTreeCDATASectionIWS::XalanSourceTreeCDATASectionIWS(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex) :
        XalanSourceTreeCDATASection(theData, theParentElement, 
thePreviousSibling, theNextSibling, theIndex)
  {
  }
  
  
  
  XalanSourceTreeCDATASectionIWS::~XalanSourceTreeCDATASectionIWS()
  {
  }
  
  
  
  XalanSourceTreeCDATASectionIWS::XalanSourceTreeCDATASectionIWS(
                        const XalanSourceTreeCDATASectionIWS&   theSource,
                        bool                                                    
                /* deep */) :
        XalanSourceTreeCDATASection(theSource)
  {
  }
  
  
  
  bool
  XalanSourceTreeCDATASectionIWS::isIgnorableWhitespace() const
  {
        return true;
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeCDATASectionIWS.hpp
  
  Index: XalanSourceTreeCDATASectionIWS.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREECDATASECTIONIWS_HEADER_GUARD_1357924680)
  #define XALANSOURCETREECDATASECTIONIWS_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeCDATASection.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeCDATASectionIWS : public 
XalanSourceTreeCDATASection
  {
  public:
  
        /**
         * Constructor.
         *
         * @param theData The text data of the node
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The previous sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         */
        XalanSourceTreeCDATASectionIWS(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        virtual
        ~XalanSourceTreeCDATASectionIWS();
  
  
        virtual bool
        isIgnorableWhitespace() const;
  
  protected:
  
        XalanSourceTreeCDATASectionIWS(
                        const XalanSourceTreeCDATASectionIWS&   theSource,
                        bool                                                    
                /* deep */);
  
  private:
  
        // Not implemented...
        XalanSourceTreeCDATASectionIWS&
        operator=(const XalanSourceTreeCDATASectionIWS&         theSource);
  
        bool
        operator==(const XalanSourceTreeCDATASectionIWS&        theRHS) const;
  };
  
  
  
  #endif        // 
!defined(XALANSOURCETREECDATASECTIONIWS_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeCDATASectionIWSAllocator.cpp
  
  Index: XalanSourceTreeCDATASectionIWSAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanSourceTreeCDATASectionIWSAllocator.hpp"
  
  
  
  
XalanSourceTreeCDATASectionIWSAllocator::XalanSourceTreeCDATASectionIWSAllocator(size_type
    theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  
XalanSourceTreeCDATASectionIWSAllocator::~XalanSourceTreeCDATASectionIWSAllocator()
  {
  }
  
  
  
  XalanSourceTreeCDATASectionIWSAllocator::ObjectType*
  XalanSourceTreeCDATASectionIWSAllocator::create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex)
  {
        ObjectType* const       theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        new(theBlock) ObjectType(
                                                theData,
                                                theParentElement,
                                                thePreviousSibling,
                                                theNextSibling,
                                                theIndex);
  
        m_allocator.commitAllocation(theBlock);
  
        return theBlock;
  }
  
  
  
  void 
  XalanSourceTreeCDATASectionIWSAllocator::reset()
  {
        m_allocator.reset();
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeCDATASectionIWSAllocator.hpp
  
  Index: XalanSourceTreeCDATASectionIWSAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREECDATASECTIONIWSALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANSOURCETREECDATASECTIONIWSALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeCDATASectionIWS.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeCDATASectionIWSAllocator
  {
  public:
  
        typedef XalanSourceTreeCDATASectionIWS                  ObjectType;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<ObjectType>                                  
ArenaBlockType;
  
        typedef ArenaAllocator<ObjectType,
                                                   ArenaBlockType>              
        ArenaAllocatorType;
  #else
        typedef ArenaAllocator<ObjectType>                              
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type                   size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanSourceTreeCDATASectionIWSAllocator(size_type       theBlockCount);
  
        ~XalanSourceTreeCDATASectionIWSAllocator();
  
        /**
         * Create an instance.
         * 
         * @param theData The data for the node
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The next sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        ObjectType*
        create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        /**
         * Delete all objects from allocator.    
         */     
        void
        reset();
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanSourceTreeCDATASectionIWSAllocator(const 
XalanSourceTreeCDATASectionIWSAllocator&);
  
        XalanSourceTreeCDATASectionIWSAllocator&
        operator=(const XalanSourceTreeCDATASectionIWSAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // 
XALANSOURCETREECDATASECTIONIWSALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeComment.cpp
  
  Index: XalanSourceTreeComment.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeComment.hpp"
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  #include <PlatformSupport/DOMStringHelper.hpp>
  
  
  
  #include "XalanSourceTreeCDATASection.hpp"
  #include "XalanSourceTreeElement.hpp"
  #include "XalanSourceTreeProcessingInstruction.hpp"
  #include "XalanSourceTreeText.hpp"
  #include "XalanSourceTreeHelper.hpp"
  
  
  
  static const XalanDOMString           s_emptyString;
  
  
  
  XalanSourceTreeComment::XalanSourceTreeComment(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex) :
        XalanComment(),
        m_data(theData),
        m_parentElement(theParentElement),
        m_previousSibling(thePreviousSibling),
        m_nextSibling(theNextSibling),
        m_index(theIndex)
  {
  }
  
  
  
  XalanSourceTreeComment::~XalanSourceTreeComment()
  {
  }
  
  
  
  XalanSourceTreeComment::XalanSourceTreeComment(
                        const XalanSourceTreeComment&   theSource,
                        bool                                                    
/* deep */) :
        XalanComment(theSource),
        m_data(theSource.m_data),
        m_parentElement(0),
        m_previousSibling(0),
        m_nextSibling(0),
        m_index(0)
  {
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeComment::getNodeName() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeComment::getNodeValue() const
  {
        return m_data;
  }
  
  
  
  XalanSourceTreeComment::NodeType
  XalanSourceTreeComment::getNodeType() const
  {
        return COMMENT_NODE;
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::getParentNode() const
  {
        return m_parentElement;
  }
  
  
  
  const XalanNodeList*
  XalanSourceTreeComment::getChildNodes() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::getFirstChild() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::getLastChild() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::getPreviousSibling() const
  {
        return m_previousSibling;
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::getNextSibling() const
  {
        return m_nextSibling;
  }
  
  
  
  const XalanNamedNodeMap*
  XalanSourceTreeComment::getAttributes() const
  {
        return 0;
  }
  
  
  
  XalanDocument*
  XalanSourceTreeComment::getOwnerDocument() const
  {
        assert(m_parentElement != 0);
  
        return m_parentElement->getOwnerDocument();
  }
  
  
  
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
  XalanNode*
  #else
  XalanSourceTreeComment*
  #endif
  XalanSourceTreeComment::cloneNode(bool        deep) const
  {
        return new XalanSourceTreeComment(*this, deep);
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::insertBefore(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* refChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::replaceChild(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::removeChild(XalanNode*        /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeComment::appendChild(XalanNode*        /* newChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  bool
  XalanSourceTreeComment::hasChildNodes() const
  {
        return false;
  }
  
  
  
  void
  XalanSourceTreeComment::setNodeValue(const XalanDOMString&            /* 
nodeValue */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeComment::normalize()
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeComment::supports(
                        const XalanDOMString&   /* feature */,
                        const XalanDOMString&   /* version */) const
  {
        return false;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeComment::getNamespaceURI() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeComment::getPrefix() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeComment::getLocalName() const
  {
        return s_emptyString;
  }
  
  
  
  void
  XalanSourceTreeComment::setPrefix(const XalanDOMString&       /* prefix */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeComment::isIndexed() const
  {
        return true;
  }
  
  
  
  unsigned long
  XalanSourceTreeComment::getIndex() const
  {
        return m_index;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeComment::getData() const
  {
        return m_data;
  }
  
  
  
  unsigned int
  XalanSourceTreeComment::getLength() const
  {
        return length(m_data);
  }
  
  
  
  XalanDOMString
  XalanSourceTreeComment::substringData(
                        unsigned int    offset,
                        unsigned int    count) const
  {
        return substring(m_data, offset, count);
  }
  
  
  
  void
  XalanSourceTreeComment::appendData(const XalanDOMString&      /* arg */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeComment::insertData(
                        unsigned int                    /* offset */,
                        const  XalanDOMString&  /* arg */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeComment::deleteData(
                        unsigned int    /* offset */,
                        unsigned int    /* count */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeComment::replaceData(
                        unsigned int                    /* offset */,
                        unsigned int                    /* count */,
                        const XalanDOMString&   /* arg */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeComment::setPreviousSibling(XalanSourceTreeComment*    
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeComment::setPreviousSibling(XalanSourceTreeCDATASection*       
        thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeComment::setPreviousSibling(XalanSourceTreeElement*    
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  
XalanSourceTreeComment::setPreviousSibling(XalanSourceTreeProcessingInstruction*
      thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeComment::setPreviousSibling(XalanSourceTreeText*               
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeComment::appendSiblingNode(XalanSourceTreeComment*     
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeComment::appendSiblingNode(XalanSourceTreeCDATASection*        
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeComment::appendSiblingNode(XalanSourceTreeElement*     
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  
XalanSourceTreeComment::appendSiblingNode(XalanSourceTreeProcessingInstruction* 
              theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeComment::appendSiblingNode(XalanSourceTreeText*        
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeComment.hpp
  
  Index: XalanSourceTreeComment.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREECOMMENT_HEADER_GUARD_1357924680)
  #define XALANSOURCETREECOMMENT_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanDOM/XalanComment.hpp>
  
  
  
  #include <XalanDOM/XalanDOMString.hpp>
  
  
  
  class XalanSourceTreeCDATASection;
  class XalanSourceTreeElement;
  class XalanSourceTreeProcessingInstruction;
  class XalanSourceTreeText;
  
  
  
  /*
   * <meta name="usage" content="experimental"/>
   *
   * Base class for the Xalan source tree Attr interface.
   *
   * This class is experimental and subject to change!!
   */
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeComment : public 
XalanComment
  {
  public:
  
        /**
         * Constructor.
         *
         * @param theData The text data of the node
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The previous sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         */
        XalanSourceTreeComment(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        virtual
        ~XalanSourceTreeComment();
  
  
        /**
         * Gets the name of this node.
         */
        virtual const XalanDOMString&
        getNodeName() const;
  
        /**
         * Gets the value of this node, depending on its type.
         */
        virtual const XalanDOMString&
        getNodeValue() const;
  
        /**
         * An enum value representing the type of the underlying object.
         */
        virtual NodeType
        getNodeType() const;
  
        /**
         * Gets the parent of this node.
         *
         * All nodes, except <code>Document</code>,
         * <code>DocumentFragment</code>, and <code>Attr</code> may have a 
parent.
         * However, if a node has just been created and not yet added to the 
tree,
         * or if it has been removed from the tree, a <code>null</code> DOM_Node
         * is returned.
         */
        virtual XalanNode*
        getParentNode() const;
  
        /**
         * Gets a <code>NodeList</code> that contains all children of this node.
         *
         * If there
         * are no children, this is a <code>NodeList</code> containing no nodes.
         * The content of the returned <code>NodeList</code> is "live" in the 
sense
         * that, for instance, changes to the children of the node object that
         * it was created from are immediately reflected in the nodes returned 
by
         * the <code>NodeList</code> accessors; it is not a static snapshot of 
the
         * content of the node. This is true for every <code>NodeList</code>,
         * including the ones returned by the <code>getElementsByTagName</code>
         * method.
         */
        virtual const XalanNodeList*
        getChildNodes() const;
  
        /**
         * Gets the first child of this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getFirstChild() const;
  
        /**
         * Gets the last child of this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getLastChild() const;
  
        /**
         * Gets the node immediately preceding this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getPreviousSibling() const;
  
        /**
         * Gets the node immediately following this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getNextSibling() const;
  
        /**
         * Gets a <code>NamedNodeMap</code> containing the attributes of this 
node (if it
         * is an <code>Element</code>) or <code>null</code> otherwise.
         */
        virtual const XalanNamedNodeMap*
        getAttributes() const;
  
        /**
         * Gets the <code>DOM_Document</code> object associated with this node.
         *
         * This is also
         * the <code>DOM_Document</code> object used to create new nodes. When 
this
         * node is a <code>DOM_Document</code> or a 
<code>DOM_DocumentType</code>
         * which is not used with any <code>DOM_Document</code> yet, this is
         * <code>null</code>.
         */
        virtual XalanDocument*
        getOwnerDocument() const;
  
        //@}
        /** @name Cloning function. */
        //@{
  
        /**
         * Returns a duplicate of this node.
         *
         * This function serves as a generic copy constructor for nodes.
         *
         * The duplicate node has no parent (
         * <code>parentNode</code> returns <code>null</code>.).
         * <br>Cloning an <code>Element</code> copies all attributes and their
         * values, including those generated by the  XML processor to represent
         * defaulted attributes, but this method does not copy any text it 
contains
         * unless it is a deep clone, since the text is contained in a child
         * <code>Text</code> node. Cloning any other type of node simply 
returns a
         * copy of this node.
         * @param deep If <code>true</code>, recursively clone the subtree 
under the
         *       specified node; if <code>false</code>, clone only the node 
itself (and
         *       its attributes, if it is an <code>Element</code>).
         * @return The duplicate node.
         */
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
        virtual XalanNode*
  #else
        virtual XalanSourceTreeComment*
  #endif
        cloneNode(bool deep) const;
  
        //@}
        /** @name Functions to modify the DOM Node. */
        //@{
  
        /**
         * Inserts the node <code>newChild</code> before the existing child node
         * <code>refChild</code>.
         *
         * If <code>refChild</code> is <code>null</code>,
         * insert <code>newChild</code> at the end of the list of children.
         * <br>If <code>newChild</code> is a <code>DocumentFragment</code> 
object,
         * all of its children are inserted, in the same order, before
         * <code>refChild</code>. If the <code>newChild</code> is already in the
         * tree, it is first removed.  Note that a <code>DOM_Node</code> that
         * has never been assigned to refer to an actual node is == null.
         * @param newChild The node to insert.
         * @param refChild The reference node, i.e., the node before which the 
new
         *       node must be inserted.
         * @return The node being inserted.
         */
        virtual XalanNode*
        insertBefore(
                        XalanNode*      newChild,
                        XalanNode*      refChild);
  
        /**
         * Replaces the child node <code>oldChild</code> with 
<code>newChild</code>
         * in the list of children, and returns the <code>oldChild</code> node.
         *
         * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> 
object,
         * <CODE>oldChild</CODE> is replaced by all of the 
<CODE>DOM_DocumentFragment</CODE>
         * children, which are inserted in the same order.
         *
         * If the <code>newChild</code> is already in the tree, it is first 
removed.
         * @param newChild The new node to put in the child list.
         * @param oldChild The node being replaced in the list.
         * @return The node replaced.
         */
        virtual XalanNode*
        replaceChild(
                        XalanNode*      newChild,
                        XalanNode*      oldChild);
  
        /**
         * Removes the child node indicated by <code>oldChild</code> from the 
list
         * of children, and returns it.
         *
         * @param oldChild The node being removed.
         * @return The node removed.
         */
        virtual XalanNode*
        removeChild(XalanNode*  oldChild);
  
        /**
         * Adds the node <code>newChild</code> to the end of the list of 
children of
         * this node.
         *
         * If the <code>newChild</code> is already in the tree, it is
         * first removed.
         * @param newChild The node to add.If it is a  
<code>DocumentFragment</code>
         *       object, the entire contents of the document fragment are moved 
into
         *       the child list of this node
         * @return The node added.
         */
        virtual XalanNode*
        appendChild(XalanNode*  newChild);
  
        //@}
        /** @name Query functions. */
        //@{
  
        /**
         *      This is a convenience method to allow easy determination of 
whether a
         * node has any children.
         *
         * @return      <code>true</code> if the node has any children,
         *       <code>false</code> if the node has no children.
         */
        virtual bool
        hasChildNodes() const;
  
  
        //@}
        /** @name Set functions. */
        //@{
  
        /**
        * Sets the value of the node.
        *
        * Any node which can have a nodeValue (@see getNodeValue) will
        * also accept requests to set it to a string. The exact response to
        * this varies from node to node -- Attribute, for example, stores
        * its values in its children and has to replace them with a new Text
        * holding the replacement value.
        *
        * For most types of Node, value is null and attempting to set it
        * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
        * also be thrown if the node is read-only.
        */
        virtual void
        setNodeValue(const XalanDOMString&              nodeValue);
  
        //@}
        /** @name Functions introduced in DOM Level 2. */
        //@{
  
        /**
         * Puts all <CODE>DOM_Text</CODE>
         * nodes in the full depth of the sub-tree underneath this 
<CODE>DOM_Node</CODE>, 
         * including attribute nodes, into a "normal" form where only markup 
(e.g., 
         * tags, comments, processing instructions, CDATA sections, and entity 
         * references) separates <CODE>DOM_Text</CODE>
         * nodes, i.e., there are no adjacent <CODE>DOM_Text</CODE>
         * nodes. This can be used to ensure that the DOM view of a document is 
the 
         * same as if it were saved and re-loaded, and is useful when 
operations 
         * (such as XPointer lookups) that depend on a particular document tree 
         * structure are to be used.
         * <P><B>Note:</B> In cases where the document contains 
<CODE>DOM_CDATASections</CODE>, 
         * the normalize operation alone may not be sufficient, since XPointers 
do 
         * not differentiate between <CODE>DOM_Text</CODE>
         * nodes and <CODE>DOM_CDATASection</CODE> nodes.</P>
         */
        virtual void
        normalize();
  
        /**
         * Tests whether the DOM implementation implements a specific
         * feature and that feature is supported by this node.
         * @param feature The string of the feature to test. This is the same
         * name as what can be passed to the method <code>hasFeature</code> on
         * <code>DOMImplementation</code>.
         * @param version This is the version number of the feature to test. In
         * Level 2, version 1, this is the string "2.0". If the version is not
         * specified, supporting any version of the feature will cause the
         * method to return <code>true</code>.
         * @return Returns <code>true</code> if the specified feature is 
supported
         * on this node, <code>false</code> otherwise.
         */
        virtual bool
        supports(
                        const XalanDOMString&   feature,
                        const XalanDOMString&   version) const;
  
        /**
         * Get the <em>namespace URI</em> of
         * this node, or <code>null</code> if it is unspecified.
         * <p>
         * This is not a computed value that is the result of a namespace lookup
         * based on an examination of the namespace declarations in scope. It is
         * merely the namespace URI given at creation time.
         * <p>
         * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and 
         * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 
method, 
         * such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
         * interface, this is always <CODE>null</CODE>.
         */
        virtual const XalanDOMString&
        getNamespaceURI() const;
  
        /**
         * Get the <em>namespace prefix</em>
         * of this node, or <code>null</code> if it is unspecified.
         */
        virtual const XalanDOMString&
        getPrefix() const;
  
        /**
         * Returns the local part of the <em>qualified name</em> of this node.
         * <p>
         * For nodes created with a DOM Level 1 method, such as
         * <code>createElement</code> from the <code>DOM_Document</code> 
interface,
         * it is null.
         */
        virtual const XalanDOMString&
        getLocalName() const;
  
        /**
         * Set the <em>namespace prefix</em> of this node.
         * <p>
         * Note that setting this attribute, when permitted, changes 
         * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified 
         * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE> 
         * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE>
         * interfaces, when applicable.
         * <p>
         * Note also that changing the prefix of an 
         * attribute, that is known to have a default value, does not make a 
new 
         * attribute with the default value and the original prefix appear, 
since the 
         * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
         *
         * @param prefix The prefix of this node.
         * @exception DOMException
         *       INVALID_CHARACTER_ERR: Raised if the specified prefix contains
         *                                                      an illegal 
character.
         * <br>
         *       NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         * <br>
         *       NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is 
         *               malformed, if the specified prefix is "xml" and the 
         *               <CODE>namespaceURI</CODE> of this node is different 
from 
         *               "http://www.w3.org/XML/1998/namespace";, if specified 
prefix is 
         *               "xmlns" and the <CODE>namespaceURI</CODE> is neither 
         *               <CODE>null</CODE> nor an empty string, or if the 
         *               <CODE>localName</CODE> is <CODE>null</CODE>.
         */
        virtual void
        setPrefix(const XalanDOMString& prefix);
  
        virtual bool
        isIndexed() const;
  
        virtual unsigned long
        getIndex() const;
  
        //@}
  
        // These interfaces are inherited from XalanCDATASection...
  
        /** @name Getter functions. */
        //@{
        /**
         * Returns the character data of the node that implements this 
interface. 
         *
         * The DOM implementation may not put arbitrary limits on the amount of 
data that 
         * may be stored in a  <code>CharacterData</code> node. However, 
         * implementation limits may  mean that the entirety of a node's data 
may 
         * not fit into a single <code>DOMString</code>. In such cases, the 
user 
         * may call <code>substringData</code> to retrieve the data in 
         * appropriately sized pieces.
         * @exception DOMException
         *       NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
         * @exception DOMException
         *       DOMSTRING_SIZE_ERR: Raised when it would return more 
characters than 
         *       fit in a <code>DOMString</code> variable on the implementation 
         *       platform.
         */
        virtual const XalanDOMString&
        getData() const;
  
        /**
         * Returns the number of characters that are available through 
<code>data</code> and 
         * the <code>substringData</code> method below. 
         *
         * This may have the value 
         * zero, i.e., <code>CharacterData</code> nodes may be empty.
         */
        virtual unsigned int
        getLength() const;
  
        /**
         * Extracts a range of data from the node.
         *
         * @param offset Start offset of substring to extract.
         * @param count The number of characters to extract.
         * @return The specified substring. If the sum of <code>offset</code> 
and 
         *       <code>count</code> exceeds the <code>length</code>, then all 
         *       characters to the end of the data are returned.
         * @exception DOMException
         *       INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
         *       than the number of characters in <code>data</code>, or if the 
         *       specified <code>count</code> is negative.
         *       <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text 
does not 
         *       fit into a <code>DOMString</code>.
         */
        virtual XalanDOMString
        substringData(
                        unsigned int    offset, 
                        unsigned int    count) const;
  
        //@}
        /** @name Functions that set or change data. */
        //@{
        /**
         * Append the string to the end of the character data of the node.
         *
         * Upon success, <code>data</code> provides access to the concatenation 
of 
         * <code>data</code> and the <code>DOMString</code> specified.
         * @param arg The <code>DOMString</code> to append.
         * @exception DOMException
         *       NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         */
        virtual void
        appendData(const XalanDOMString&        arg);
  
        /**
         * Insert a string at the specified character offset.
         *
         * @param offset The character offset at which to insert.
         * @param arg The <code>DOMString</code> to insert.
         * @exception DOMException
         *       INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
         *       than the number of characters in <code>data</code>.
         *       <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is 
readonly.
         */
        virtual void
        insertData(
                        unsigned int                    offset,
                        const  XalanDOMString&  arg);
  
        /**
         * Remove a range of characters from the node. 
         *
         * Upon success, 
         * <code>data</code> and <code>length</code> reflect the change.
         * @param offset The offset from which to remove characters.
         * @param count The number of characters to delete. If the sum of 
         *       <code>offset</code> and <code>count</code> exceeds 
<code>length</code> 
         *       then all characters from <code>offset</code> to the end of the 
data 
         *       are deleted.
         * @exception DOMException
         *       INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
         *       than the number of characters in <code>data</code>, or if the 
         *       specified <code>count</code> is negative.
         *       <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is 
readonly.
         */
        virtual void
        deleteData(
                        unsigned int    offset, 
                        unsigned int    count);
  
        /**
         * Replace the characters starting at the specified character offset 
with 
         * the specified string.
         *
         * @param offset The offset from which to start replacing.
         * @param count The number of characters to replace. If the sum of 
         *       <code>offset</code> and <code>count</code> exceeds 
<code>length</code>
         *       , then all characters to the end of the data are replaced 
(i.e., the 
         *       effect is the same as a <code>remove</code> method call with 
the same 
         *       range, followed by an <code>append</code> method invocation).
         * @param arg The <code>DOMString</code> with which the range must be 
         *       replaced.
         * @exception DOMException
         *       INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
         *       than the number of characters in <code>data</code>, or if the 
         *       specified <code>count</code> is negative.
         *       <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is 
readonly.
         */
        virtual void
        replaceData(
                        unsigned int                    offset, 
                        unsigned int                    count, 
                        const XalanDOMString&   arg);
  
    //@}
  
  
        // public interfaces not inherited from XalanComment...
  
        XalanSourceTreeElement*
        getParentElement() const
        {
                return m_parentElement;
        }
  
        void
        setParentElement(XalanSourceTreeElement*        theParentElement)
        {
                m_parentElement = theParentElement;
        }
  
        void
        setPreviousSibling(XalanSourceTreeComment*      thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeCDATASection*         
thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeElement*      thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeProcessingInstruction*        
thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeText*         thePreviousSibling);
  
        void
        appendSiblingNode(XalanSourceTreeComment*       theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeCDATASection*  theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeElement*       theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeProcessingInstruction*         
theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeText*  theSibling);
  
        void
        setIndex(unsigned int   theIndex)
        {
                m_index = theIndex;
        }
  
  protected:
  
        XalanSourceTreeComment(
                        const XalanSourceTreeComment&   theSource,
                        bool                                                    
deep = false);
  
  private:
  
        // Not implemented...
        XalanSourceTreeComment&
        operator=(const XalanSourceTreeComment& theSource);
  
        bool
        operator==(const XalanSourceTreeComment&        theRHS) const;
  
  
        // Data members...
        const XalanDOMString&           m_data;
  
        XalanSourceTreeElement*         m_parentElement;
  
        XalanNode*                                      m_previousSibling;
  
        XalanNode*                                      m_nextSibling;
  
        unsigned int                            m_index;
  };
  
  
  
  #endif        // !defined(XALANSOURCETREECOMMENT_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeCommentAllocator.cpp
  
  Index: XalanSourceTreeCommentAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanSourceTreeCommentAllocator.hpp"
  
  
  
  XalanSourceTreeCommentAllocator::XalanSourceTreeCommentAllocator(size_type    
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanSourceTreeCommentAllocator::~XalanSourceTreeCommentAllocator()
  {
  }
  
  
  
  XalanSourceTreeCommentAllocator::ObjectType*
  XalanSourceTreeCommentAllocator::create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex)
  {
        ObjectType* const       theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        new(theBlock) ObjectType(
                                                theData,
                                                theParentElement,
                                                thePreviousSibling,
                                                theNextSibling,
                                                theIndex);
  
        m_allocator.commitAllocation(theBlock);
  
        return theBlock;
  }
  
  
  
  void 
  XalanSourceTreeCommentAllocator::reset()
  {
        m_allocator.reset();
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeCommentAllocator.hpp
  
  Index: XalanSourceTreeCommentAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREECOMMENTALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANSOURCETREECOMMENTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeComment.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeCommentAllocator
  {
  public:
  
        typedef XalanSourceTreeComment                                  
ObjectType;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<ObjectType>                                  
ArenaBlockType;
  
        typedef ArenaAllocator<ObjectType,
                                                   ArenaBlockType>              
        ArenaAllocatorType;
  #else
        typedef ArenaAllocator<ObjectType>                              
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type                   size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanSourceTreeCommentAllocator(size_type       theBlockCount);
  
        ~XalanSourceTreeCommentAllocator();
  
        /**
         * Create an instance.
         * 
         * @param theData The data for the comment
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The next sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        ObjectType*
        create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        /**
         * Delete all objects from allocator.    
         */     
        void
        reset();
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanSourceTreeCommentAllocator(const XalanSourceTreeCommentAllocator&);
  
        XalanSourceTreeCommentAllocator&
        operator=(const XalanSourceTreeCommentAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANSOURCETREECOMMENTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeContentHandler.cpp
  
  Index: XalanSourceTreeContentHandler.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 1999-2000 The Apache Software Foundation.    All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer. 
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   * 
   * 3. The end-user documentation included with the redistribution,
   *      if any, must include the following acknowledgment:  
   *             "This product includes software developed by the
   *              Apache Software Foundation (http://www.apache.org/)."
   *      Alternately, this acknowledgment may appear in the software itself,
   *      if and wherever such third-party acknowledgments normally appear.
   * 
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *      not be used to endorse or promote products derived from this
   *      software without prior written permission. For written 
   *      permission, please contact [EMAIL PROTECTED]
   * 
   * 5. Products derived from this software may not be called "Apache",
   *      nor may "Apache" appear in their name, without prior written
   *      permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.        IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "XalanSourceTreeContentHandler.hpp"
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  #include <PlatformSupport/DOMStringHelper.hpp>
  
  
  
  #include "XalanSourceTreeDocument.hpp"
  #include "XalanSourceTreeElement.hpp"
  
  
  
  XalanSourceTreeContentHandler::XalanSourceTreeContentHandler(
                        XalanSourceTreeDocument*        theDocument,
                        bool                                            
fAccumulateText) :
        ContentHandler(),
        DTDHandler(),
        m_document(theDocument),
        m_currentElement(0),
        m_elementStack(),
        m_ownsDocument(false),
        m_accumulateText(fAccumulateText),
        m_textBuffer()
  {
  }
  
  
  
  XalanSourceTreeContentHandler::~XalanSourceTreeContentHandler()
  {
        if (m_ownsDocument == true)
        {
                delete m_document;
        }
  }
  
  
  
  void
  XalanSourceTreeContentHandler::characters(
                        const   XMLCh* const    chars,
                        const unsigned int              length)
  {
        if (m_currentElement == 0)
        {
                if (isXMLWhitespace(chars) == false)
                {
                        throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
                }
        }
        else if (m_accumulateText == true)
        {
                append(m_textBuffer, chars, length);
        }
        else
        {
                doCharacters(chars, length);
        }
  }
  
  
  
  void
  XalanSourceTreeContentHandler::endDocument()
  {
        assert(m_elementStack.empty() == true);
  
        assert(isEmpty(m_textBuffer) == true);
  }
  
  
  
  void
  XalanSourceTreeContentHandler::endElement(
                        const XMLCh* const      /* uri */, 
                        const XMLCh* const      /* localname */, 
                        const XMLCh* const      /* qname */)
  {
        processAccumulatedText();
  
        assert(m_elementStack.empty() == false);
  
        // Pop the element of the stack...
        m_elementStack.pop_back();
  
        // Get the element from the back of the
        // stack, if any...
        if (m_elementStack.empty() == false)
        {
                m_currentElement = m_elementStack.back();
        }
        else
        {
                m_currentElement = 0;
        }
  }
  
  
  
  void
  XalanSourceTreeContentHandler::ignorableWhitespace(
                        const XMLCh* const      chars,
                        const unsigned int      length)
  {
        if (m_currentElement == 0)
        {
                throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
        }
        else
        {
                processAccumulatedText();
  
                
m_currentElement->appendChildNode(m_document->createTextIWSNode(chars, length, 
m_currentElement));
        }
  }
  
  
  
  void
  XalanSourceTreeContentHandler::processingInstruction(
                const XMLCh* const      target,
                const XMLCh* const      data)
  {
        if (m_currentElement == 0)
        {
                assert(m_document != 0);
  
                
m_document->appendChildNode(m_document->createProcessingInstructionNode(target, 
data));
        }
        else
        {
                processAccumulatedText();
  
                
m_currentElement->appendChildNode(m_document->createProcessingInstructionNode(target,
 data, m_currentElement));
        }
  }
  
  
  
  void
  XalanSourceTreeContentHandler::setDocumentLocator(const Locator* const        
/* locator */)
  {
  }
  
  
  
  void
  XalanSourceTreeContentHandler::startDocument()
  {
        if (m_document == 0)
        {
                m_document = new XalanSourceTreeDocument;
        }
        else if (m_ownsDocument == true)
        {
                delete m_document;
  
                m_document = new XalanSourceTreeDocument;
        }
  
        m_elementStack.clear();
  
        m_elementStack.reserve(eDefaultStackSize);
  
        if (m_accumulateText == true)
        {
                clear(m_textBuffer);
  
                reserve(m_textBuffer, eDefaultTextBufferSize);
        }
  }
  
  
  
  void
  XalanSourceTreeContentHandler::startElement(
                        const XMLCh* const      uri,
                        const XMLCh* const      localname,
                        const XMLCh* const      qname,
                        const Attributes&       attrs)
  {
        processAccumulatedText();
  
        XalanSourceTreeElement* const   theNewElement =
                createElement(uri, localname, qname, attrs, m_currentElement);
  
        if (m_currentElement == 0)
        {
                if (m_document->getDocumentElement() != 0)
                {
                        throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
                }
                else
                {
                        m_document->setDocumentElement(theNewElement);
                }
        }
        else
        {
                m_currentElement->appendChildNode(theNewElement);
        }
  
        m_elementStack.push_back(theNewElement);
  
        m_currentElement = theNewElement;
  }
  
  
  
  void
  XalanSourceTreeContentHandler::startPrefixMapping(
                const XMLCh* const      /* prefix */,
                const XMLCh* const      /* uri */)
  {
  }
  
  
  
  void
  XalanSourceTreeContentHandler::endPrefixMapping(const XMLCh* const    /* 
prefix */)
  {
  }
  
  
  
  void
  XalanSourceTreeContentHandler::skippedEntity(const XMLCh* const               
/* name */)
  {
  }
  
  
  
  void
  XalanSourceTreeContentHandler::notationDecl(
                        const XMLCh* const    name,
                        const XMLCh* const    publicId,
                        const XMLCh* const    systemId)
  {
  }
  
  
  
  void
  XalanSourceTreeContentHandler::unparsedEntityDecl(
                        const XMLCh* const    name,
                        const XMLCh* const    publicId,
                        const XMLCh* const    systemId,
                        const XMLCh* const    notationName)
  {
        assert(m_document != 0);
  
        m_document->unparsedEntityDecl(name, publicId, systemId, notationName);
  }
  
  
  
  void
  XalanSourceTreeContentHandler::resetDocType()
  {
  }
  
  
  
  void
  XalanSourceTreeContentHandler::setDocument(XalanSourceTreeDocument*   
theDocument)
  {
        if (m_ownsDocument == true)
        {
                delete m_document;
        }
  
        m_document = theDocument;
  }
  
  
  
  XalanSourceTreeDocument*
  XalanSourceTreeContentHandler::detachDocument()
  {
        XalanSourceTreeDocument* const  theDocument = m_document;
  
        m_document = 0;
  
        m_ownsDocument = false;
  
        return theDocument;
  }
  
  
  
  XalanSourceTreeElement*
  XalanSourceTreeContentHandler::createElement(
                        const XMLCh* const                      uri,
                        const XMLCh* const                      localname,
                        const XMLCh* const                      qname,
                        const Attributes&                       attrs,
                        XalanSourceTreeElement*         theOwnerElement)
  {
  #if 1
        if (equals(uri, XALAN_STATIC_UCODE_STRING("EMPTY")) == false)
  #else
        if (uri != 0 && length(uri) != 0)
  #endif
        {
                return m_document->createElementNode(uri, localname, qname, 
attrs, theOwnerElement);
        }
        else
        {
                return m_document->createElementNode(qname, attrs, 
theOwnerElement);
        }
  }
  
  
  
  void
  XalanSourceTreeContentHandler::processAccumulatedText()
  {
        if (isEmpty(m_textBuffer) == false)
        {
                doCharacters(c_wstr(m_textBuffer), length(m_textBuffer));
  
                clear(m_textBuffer);
        }
  }
  
  
  
  void
  XalanSourceTreeContentHandler::doCharacters(
                        const XMLCh*    chars,
                        unsigned int    length)
  {
        m_currentElement->appendChildNode(m_document->createTextNode(chars, 
length, m_currentElement));
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeContentHandler.hpp
  
  Index: XalanSourceTreeContentHandler.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   * 
   * Copyright (c) 1999-2000 The Apache Software Foundation.    All rights
   * reserved.
   * 
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   * 
   * 1. Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer. 
   * 
   * 2. Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   * 
   * 3. The end-user documentation included with the redistribution,
   *      if any, must include the following acknowledgment:  
   *             "This product includes software developed by the
   *              Apache Software Foundation (http://www.apache.org/)."
   *      Alternately, this acknowledgment may appear in the software itself,
   *      if and wherever such third-party acknowledgments normally appear.
   * 
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *      not be used to endorse or promote products derived from this
   *      software without prior written permission. For written 
   *      permission, please contact [EMAIL PROTECTED]
   * 
   * 5. Products derived from this software may not be called "Apache",
   *      nor may "Apache" appear in their name, without prior written
   *      permission of the Apache Software Foundation.
   * 
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.        IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   * 
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation, and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680)
  #define XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <vector>
  
  
  
  #include <sax/DocumentHandler.hpp>
  #include <sax/DTDHandler.hpp>
  #include <sax2/ContentHandler.hpp>
  
  
  
  #include <XalanDOM/XalanDOMString.hpp>
  
  
  
  class XalanSourceTreeDocument;
  class XalanSourceTreeElement;
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeContentHandler : public 
ContentHandler, public DTDHandler
  {
  public:
        /** @name Constructors and Destructor */
  
  #if defined(XALAN_NO_NAMESPACES)
        typedef vector<XalanSourceTreeElement*>                 
ElementStackType;
  #else
        typedef std::vector<XalanSourceTreeElement*>    ElementStackType;
  #endif
  
        enum { eDefaultStackSize = 50, eDefaultTextBufferSize = 100 };
  
        //@{
  
        // Constructor
        explicit
        XalanSourceTreeContentHandler(
                        XalanSourceTreeDocument*        theDocument = 0,
                        bool                                            
fAccumulateText = true);
  
        virtual
        ~XalanSourceTreeContentHandler();
  
  
        // Inherited from ContentHandler...
        virtual void
        characters(
                        const XMLCh* const      chars,
                        const unsigned int      length);
  
        virtual void
        endDocument();
  
        virtual void
        endElement(
                        const XMLCh* const      uri, 
                        const XMLCh* const      localname, 
                        const XMLCh* const      qname);
  
        virtual void
        ignorableWhitespace(
                        const XMLCh* const      chars,
                        const unsigned int      length);
  
        virtual void
        processingInstruction(
                const XMLCh* const      target,
                const XMLCh* const      data);
  
        virtual void
        setDocumentLocator(const Locator* const         locator);
  
        virtual void
        startDocument();
  
        virtual void
        startElement(
                        const XMLCh* const      uri,
                        const XMLCh* const      localname,
                        const XMLCh* const      qname,
                        const Attributes&       attrs);
  
        virtual void
        startPrefixMapping(
                const XMLCh* const      prefix,
                const XMLCh* const      uri);
  
        virtual void
        endPrefixMapping(const XMLCh* const             prefix);
  
  
        virtual void
        skippedEntity(const XMLCh* const        name);
  
  
        // Inherited from DTDHandler...
  
        virtual void
        notationDecl(
                        const XMLCh* const    name,
                        const XMLCh* const    publicId,
                        const XMLCh* const    systemId);
  
        virtual void
        unparsedEntityDecl(
                        const XMLCh* const    name,
                        const XMLCh* const    publicId,
                        const XMLCh* const    systemId,
                        const XMLCh* const    notationName);
  
      virtual void
        resetDocType();
  
  
        // New to XalanSourceTreeContentHandler...
  
        XalanSourceTreeDocument*
        getDocument() const
        {
                return m_document;
        }
  
        void
        setDocument(XalanSourceTreeDocument*    theDocument);
  
        XalanSourceTreeDocument*
        detachDocument();
  
  private:
  
        // Not implemented...
        XalanSourceTreeContentHandler(const XalanSourceTreeContentHandler&);
  
        XalanSourceTreeContentHandler&
        operator=(const XalanSourceTreeContentHandler&);
  
        bool
        operator==(const XalanSourceTreeContentHandler&) const;
  
        // Helper functions...
        XalanSourceTreeElement*
        createElement(
                        const XMLCh* const                      uri,
                        const XMLCh* const                      localname,
                        const XMLCh* const                      qname,
                        const Attributes&                       attrs,
                        XalanSourceTreeElement*         theOwnerElement);
  
        void
        processAccumulatedText();
  
        void
        doCharacters(
                        const XMLCh*    chars,
                        unsigned int    length);
  
  
        // Data members...
        XalanSourceTreeDocument*        m_document;
  
        XalanSourceTreeElement*         m_currentElement;
  
        ElementStackType                        m_elementStack;
  
        bool                                            m_ownsDocument;
  
        const bool                                      m_accumulateText;
  
        XalanDOMString                          m_textBuffer;
  };
  
  
  
  #endif        // #if 
!defined(XALANSOURCETREECONTENTHANDLER_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDefinitions.hpp
  
  Index: XalanSourceTreeDefinitions.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREEDEFINITIONS_HEADER_GUARD_1357924680)
  #define XALANSOURCETREEDEFINITIONS_HEADER_GUARD_1357924680
  
  
  
  #include <Include/PlatformDefinitions.hpp>
  
  
  
  #if defined(XALAN_XALANSOURCETREE_BUILD_DLL)
  
  #define XALAN_XALANSOURCETREE_EXPORT XALAN_PLATFORM_EXPORT
  
  #define XALAN_XALANSOURCETREE_EXPORT_FUNCTION(T) 
XALAN_PLATFORM_EXPORT_FUNCTION(T)
  
  #else
  
  #define XALAN_XALANSOURCETREE_EXPORT XALAN_PLATFORM_IMPORT
  
  #define XALAN_XALANSOURCETREE_EXPORT_FUNCTION(T) 
XALAN_PLATFORM_IMPORT_FUNCTION(T)
  
  #endif
  
  
  
  #endif        // XALANSOURCETREEDEFINITIONS_HEADER_GUARD_1357924680
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDocument.cpp
  
  Index: XalanSourceTreeDocument.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *      if any, must include the following acknowledgment:  
   *             "This product includes software developed by the
   *              Apache Software Foundation (http://www.apache.org/)."
   *      Alternately, this acknowledgment may appear in the software itself,
   *      if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *      not be used to endorse or promote products derived from this
   *      software without prior written permission. For written 
   *      permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *      nor may "Apache" appear in their name, without prior written
   *      permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.        IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeDocument.hpp"
  
  
  
  #include <sax/AttributeList.hpp>
  #include <sax2/Attributes.hpp>
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  #include <PlatformSupport/XalanUnicode.hpp>
  
  
  
  #include "XalanSourceTreeHelper.hpp"
  
  
  
  static const XalanDOMString           s_emptyString;
  
  
  
  XalanSourceTreeDocument::XalanSourceTreeDocument(bool fDynamic) :
        XalanDocument(),
        m_firstChild(0),
        m_documentElement(0),
        m_children(*this),
        m_attributeAllocator(50),
        m_attributeNSAllocator(50),
        m_commentAllocator(20),
        m_cdataSectionAllocator(20),
        m_cdataSectionIWSAllocator(20),
        m_elementAllocator(50),
        m_elementNSAllocator(50),
        m_piAllocator(25),
        m_textAllocator(50),
        m_textIWSAllocator(50),
        m_stringPool(),
        m_attributesVector(),
        m_nextIndexValue(2),
        m_dynamic(fDynamic),
        m_elementsByID(),
        m_unparsedEntityURIs()
  {
  }
  
  
  
  XalanSourceTreeDocument::~XalanSourceTreeDocument()
  {
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDocument::getNodeName() const
  {
        return s_nameString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDocument::getNodeValue() const
  {
        return s_emptyString;
  }
  
  
  
  XalanSourceTreeDocument::NodeType
  XalanSourceTreeDocument::getNodeType() const
  {
        return DOCUMENT_NODE;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::getParentNode() const
  {
        return 0;
  }
  
  
  
  const XalanNodeList*
  XalanSourceTreeDocument::getChildNodes() const
  {
        return &m_children;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::getFirstChild() const
  {
        return m_firstChild;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::getLastChild() const
  {
        return m_documentElement;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::getPreviousSibling() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::getNextSibling() const
  {
        return 0;
  }
  
  
  
  const XalanNamedNodeMap*
  XalanSourceTreeDocument::getAttributes() const
  {
        return 0;
  }
  
  
  
  XalanDocument*
  XalanSourceTreeDocument::getOwnerDocument() const
  {
        return 0;
  }
  
  
  
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
  XalanNode*
  #else
  XalanSourceTreeDocument*
  #endif
  XalanSourceTreeDocument::cloneNode(bool               /* deep */) const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::insertBefore(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* refChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::replaceChild(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::removeChild(XalanNode*        /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::appendChild(XalanNode*               /* newChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  bool
  XalanSourceTreeDocument::hasChildNodes() const
  {
        return m_documentElement != 0 ? true : false;
  }
  
  
  
  void
  XalanSourceTreeDocument::setNodeValue(const XalanDOMString&           /* 
nodeValue */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeDocument::normalize()
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  bool
  XalanSourceTreeDocument::supports(
                        const XalanDOMString&   /* feature */,
                        const XalanDOMString&   /* version */) const
  {
        return false;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDocument::getNamespaceURI() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDocument::getPrefix() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDocument::getLocalName() const
  {
        return s_nameString;
  }
  
  
  
  void
  XalanSourceTreeDocument::setPrefix(const XalanDOMString&      /* prefix */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeDocument::isIndexed() const
  {
        return true;
  }
  
  
  
  unsigned long
  XalanSourceTreeDocument::getIndex() const
  {
        return 1;
  }
  
  
  
  XalanElement*
  XalanSourceTreeDocument::createElement(const XalanDOMString&  /* tagName */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanDocumentFragment*
  XalanSourceTreeDocument::createDocumentFragment()
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanText*
  XalanSourceTreeDocument::createTextNode(const XalanDOMString& /* data */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanComment*
  XalanSourceTreeDocument::createComment(const XalanDOMString&  /* data */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanCDATASection*
  XalanSourceTreeDocument::createCDATASection(const XalanDOMString&     /* data 
*/)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanProcessingInstruction*
  XalanSourceTreeDocument::createProcessingInstruction(
                        const XalanDOMString&   /* target */,
                        const XalanDOMString&   /* data */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanAttr*
  XalanSourceTreeDocument::createAttribute(const XalanDOMString&        /* name 
*/)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanEntityReference*
  XalanSourceTreeDocument::createEntityReference(const XalanDOMString&  /* name 
*/)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanDocumentType*
  XalanSourceTreeDocument::getDoctype() const
  {
        return 0;
  }
  
  
  
  
  XalanDOMImplementation*
  XalanSourceTreeDocument::getImplementation() const
  {
        return 0;
  }
  
  
  
  XalanElement*
  XalanSourceTreeDocument::getDocumentElement() const
  {
        return m_documentElement;
  }
  
  
  
  XalanNodeList*
  XalanSourceTreeDocument::getElementsByTagName(const XalanDOMString&   /* 
tagname */) const
  {
        // Not supported...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeDocument::importNode(
                        XalanNode*      /* importedNode */,
                        bool            /* deep */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        return 0;
  }
  
  
  
  XalanElement*
  XalanSourceTreeDocument::createElementNS(
                        const XalanDOMString&   /* namespaceURI */,
                        const XalanDOMString&   /* qualifiedName */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        return 0;
  }
  
  
  
  XalanAttr*
  XalanSourceTreeDocument::createAttributeNS(
                        const XalanDOMString&   /* namespaceURI */,
                        const XalanDOMString&   /* qualifiedName */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        return 0;
  }
  
  
  
  XalanNodeList*
  XalanSourceTreeDocument::getElementsByTagNameNS(
                        const XalanDOMString&   /* namespaceURI */,
                        const XalanDOMString&   /* localName */) const
  {
        // Not supported
        return 0;
  }
  
  
  
  XalanElement*
  XalanSourceTreeDocument::getElementById(const XalanDOMString& elementId) const
  {
        const ElementByIDMapType::const_iterator        i =
                m_elementsByID.find(c_wstr(elementId));
  
        if (i == m_elementsByID.end())
        {
                return 0;
        }
        else
        {
                return (*i).second;
        }
  }
  
  
  
  #if 0
  void
  XalanSourceTreeDocument::buildBridgeNodes()
  {
        const DOM_Node  theStartChild = m_xercesDocument.getFirstChild();
  
        if (theStartChild.isNull() == false)
        {
                assert(m_navigators.back().getIndex() == 1);
                assert(m_navigators.size() == 1);
  
                BuildBridgeTreeWalker   theTreeWalker(
                                this,
                                &m_navigators.back(),
                                m_navigators,
                                2);
  
                theTreeWalker.traverse(theStartChild, m_xercesDocument);
        }
  
        // OK, now set m_documentElement...
        XalanNode*      theChild = m_navigator.getFirstChild();
  
        while(theChild != 0 && theChild->getNodeType() != 
XalanNode::ELEMENT_NODE)
        {
                theChild = theChild->getNextSibling();
        }
  
  #if defined(XALAN_OLD_STYLE_CASTS)
        m_documentElement = (XalanElement*)theChild;
  #else
        m_documentElement = static_cast<XalanElement*>(theChild);
  #endif
  
        m_indexValid = true;
  
        m_mappingMode = false;
  }
  
  
  
  XalanSourceTreeDocument::BuildBridgeTreeWalker::BuildBridgeTreeWalker(
                        XalanSourceTreeDocument*                theDocument,
                        XercesBridgeNavigator*          theDocumentNavigator,
                        NavigatorBridgeVectorType&      theNavigators,
                        unsigned long                           theStartIndex) :
        m_document(theDocument),
        m_navigators(theNavigators),
        m_currentIndex(theStartIndex),
        m_parentNavigatorStack(),
        m_siblingNavigatorStack()
  {
        assert(theDocument != 0 && theDocumentNavigator != 0);
  
        // Reserve some space...
        m_parentNavigatorStack.reserve(100);
        m_parentNavigatorStack.reserve(100);
  
        // The document navigator is the last navigator on the stack...
        
m_parentNavigatorStack.push_back(NavigatorStackEntryType(theDocumentNavigator, 
theDocument));
  
        // There is no previous sibling...
        m_siblingNavigatorStack.push_back(NavigatorStackEntryType(0, 0));
  }
  
  
  
  XalanSourceTreeDocument::BuildBridgeTreeWalker::~BuildBridgeTreeWalker()
  {
  }
  
  
  
  void
  XalanSourceTreeDocument::BuildBridgeTreeWalker::startNode(const DOM_Node&     
node)
  {
        XalanNode* const        theBridgeNode = 
m_document->createBridgeNode(node, m_currentIndex, false);
  
        XercesBridgeNavigator&  theCurrentNodeNavigator = m_navigators.back();
  
        assert(m_parentNavigatorStack.empty() == false);
        assert(m_siblingNavigatorStack.empty() == false);
  
        // Get the two navigators...
        NavigatorStackEntryType&        theParentEntry = 
m_parentNavigatorStack.back();
        NavigatorStackEntryType&        theSiblingEntry = 
m_siblingNavigatorStack.back();
  
        theCurrentNodeNavigator.setParentNode(theParentEntry.m_node);
  
        // If the first child has not been set, then set it
        // now...
        if (theParentEntry.m_navigator->getFirstChild() == 0)
        {
                assert(theSiblingEntry.m_node == 0);
  
                theParentEntry.m_navigator->setFirstChild(theBridgeNode);
        }
  
        // Always set the last child...
        theParentEntry.m_navigator->setLastChild(theBridgeNode);
  
        theCurrentNodeNavigator.setPreviousSibling(theSiblingEntry.m_node);
  
        if (theSiblingEntry.m_navigator != 0)
        {
                theSiblingEntry.m_navigator->setNextSibling(theBridgeNode);
        }
  
        // Build an entry for the stacks...
        const NavigatorStackEntryType   
theCurrentEntry(&theCurrentNodeNavigator, theBridgeNode);
  
        // My child nodes will now be visited, so push the current
        // context on the parent stack...
        m_parentNavigatorStack.push_back(theCurrentEntry);
  
        // My siblings will also need to know about me as well...
        m_siblingNavigatorStack.push_back(theCurrentEntry);
  
        // This will serve to mark the sibling context for my first child,
        // since it has no previous sibling.  This will be popped off
        // when endNode() is called.
        m_siblingNavigatorStack.push_back(NavigatorStackEntryType(0, 0));
  
        // Finally, increment the index counter...
        ++m_currentIndex;
  
        const short             theType = node.getNodeType();
  
        if (theType == DOM_Node::DOCUMENT_TYPE_NODE)
        {
                // Special case for doctype -- we have to build its entities...
                const DOM_DocumentType&         theDoctype =
  #if defined(XALAN_OLD_STYLE_CASTS)
                        (const DOM_DocumentType&)node;
  #else
                        static_cast<const DOM_DocumentType&>(node);
  #endif
  
                const DOM_NamedNodeMap  theEntities =
                        theDoctype.getEntities();
  
                const unsigned int      theLength =
                        theEntities.getLength();
  
                for (unsigned int i = 0; i < theLength; ++i)
                {
                        // Build it, but don't index it...
                        m_document->createBridgeNode(theEntities.item(i), 
m_currentIndex++, true);
                }
        }
        else if (theType == DOM_Node::ELEMENT_NODE)
        {
        // Special case for element nodes -- we have to build the attributes...
                const DOM_Element&      theElement =
  #if defined(XALAN_OLD_STYLE_CASTS)
                        (const DOM_Element&)node;
  #else
                        static_cast<const DOM_Element&>(node);
  #endif
  
                const DOM_NamedNodeMap  theAttributes =
                        theElement.getAttributes();
  
                const unsigned int      theLength =
                        theAttributes.getLength();
  
                XercesBridgeNavigator*  thePreviousAttrNavigator = 0;
                XalanNode*                              thePreviousAttr = 0;
  
                for (unsigned int i = 0; i < theLength; ++i)
                {
                        // Get the attribute from the node map...
                        const DOM_Node  theAttr = theAttributes.item(i);
                        assert(theAttr.isNull() == false);
  
                        // Create a bridge node.
                        XalanNode* const        theCurrentAttr =
                                m_document->createBridgeNode(theAttr, 
m_currentIndex, false);
                        assert(theCurrentAttr != 0);
  
                        // Get the attribute node's navigator...
                        XercesBridgeNavigator&  theCurrentAttrNavigator =
                                m_navigators.back();
  
                        // Set the parent node...
                        theCurrentAttrNavigator.setParentNode(theBridgeNode);
  
                        if (thePreviousAttr != 0)
                        {
                                assert(thePreviousAttrNavigator != 0);
  
                                // Link in the previous attribute...
                                
theCurrentAttrNavigator.setPreviousSibling(thePreviousAttr);
  
                                
thePreviousAttrNavigator->setNextSibling(theCurrentAttr);
                        }
  
                        // Update the pointers so they point to this 
attribute...
                        thePreviousAttr = theCurrentAttr;
                        thePreviousAttrNavigator = &theCurrentAttrNavigator;
  
                        // Finally, increment the index...
                        ++m_currentIndex;
                }
        }
  }
  
  
  
  void
  XalanSourceTreeDocument::BuildBridgeTreeWalker::endNode(const DOM_Node&       
/* node */)
  {
        assert(m_parentNavigatorStack.empty() == false);
        assert(m_siblingNavigatorStack.empty() == false);
  
        // I have to pop my entry, since my children are finished...
        m_parentNavigatorStack.pop_back();
  
        // Pop any sibling navigators my child pushed...
        while(m_siblingNavigatorStack.back().m_navigator != 0)
        {
                assert(m_siblingNavigatorStack.back().m_node != 0);
  
                m_siblingNavigatorStack.pop_back();
        }
  
        // There must be a context marker...
        assert(m_siblingNavigatorStack.back().m_navigator == 0 &&
                   m_siblingNavigatorStack.back().m_node == 0);
  
        // Pop the context marker...
        m_siblingNavigatorStack.pop_back();
  }
  #endif
  
  
  
  XalanSourceTreeElement*
  XalanSourceTreeDocument::createElementNode(
                        const XalanDOMChar*                     name,
                        const AttributeList&            attrs,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        const unsigned int      theAttributeCount = attrs.getLength();
  
        XalanSourceTreeAttr** const             theAttributeVector =
                theAttributeCount == 0 ? 0 : 
m_attributesVector.allocate(theAttributeCount);
  
        XalanSourceTreeElement* const   theNewElement =
                        m_elementAllocator.create(
                                m_stringPool.get(name),
                                this,
                                theAttributeVector,
                                theAttributeCount,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
  
        // Now, create the attributes...
        for(unsigned int i = 0; i < theAttributeCount; ++i)
        {
                const XalanDOMChar* const       theName =
                        attrs.getName(i);
                assert(theName != 0);
  
                const XalanDOMChar* const       theValue =
                        attrs.getValue(i);
                assert(theValue != 0);
  
                theAttributeVector[i] =
                        m_attributeAllocator.create(
                                m_stringPool.get(theName),
                                m_stringPool.get(theValue),
                                theNewElement,
                                m_nextIndexValue++);
        }
  
        return theNewElement;
  }
  
  
  
  XalanSourceTreeElement*
  XalanSourceTreeDocument::createElementNode(
                        const XalanDOMChar*                     uri,
                        const XalanDOMChar*                     localname,
                        const XalanDOMChar*                     qname,
                        const Attributes&                       attrs,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        const unsigned int      theAttributeCount = attrs.getLength();
  
        XalanSourceTreeAttr** const             theAttributeVector =
                theAttributeCount == 0 ? 0 : 
m_attributesVector.allocate(theAttributeCount);
  
        const unsigned int      theColonIndex = indexOf(qname, 
XalanUnicode::charColon);
        const unsigned int      theLength = length(qname);
  
        XalanSourceTreeElement* const   theNewElement =
                m_elementNSAllocator.create(
                                m_stringPool.get(qname),
                                m_stringPool.get(localname),
                                m_stringPool.get(uri),
                                // This is the prefix...
                                theColonIndex == theLength ? 
m_stringPool.get(XalanDOMString()) : m_stringPool.get(qname, theColonIndex),
                                this,
                                theAttributeVector,
                                theAttributeCount,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
  
        if (theAttributeCount != 0)
        {
                createAttributes(attrs, theAttributeVector, theAttributeCount, 
theNewElement);
        }
  
        return theNewElement;
  }
  
  
  
  XalanSourceTreeElement*
  XalanSourceTreeDocument::createElementNode(
                        const XalanDOMChar*                     name,
                        const Attributes&                       attrs,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        const unsigned int      theAttributeCount = attrs.getLength();
  
        XalanSourceTreeAttr** const             theAttributeVector =
                theAttributeCount == 0 ? 0 : 
m_attributesVector.allocate(theAttributeCount);
  
        assert(indexOf(name, XalanUnicode::charColon) == length(name));
  
        XalanSourceTreeElement* const   theNewElement =
                m_elementAllocator.create(
                                m_stringPool.get(name),
                                this,
                                theAttributeVector,
                                theAttributeCount,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
  
        if (theAttributeCount != 0)
        {
                createAttributes(attrs, theAttributeVector, theAttributeCount, 
theNewElement);
        }
  
        return theNewElement;
  }
  
  
  
  XalanSourceTreeCDATASection*
  XalanSourceTreeDocument::createCDATASectionNode(
                        const XalanDOMChar*                     chars,
                        unsigned int                            length,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        const XalanDOMString&   theString = m_stringPool.get(chars, length);
  
        if (isXMLWhitespace(theString) == true)
        {
                return m_cdataSectionIWSAllocator.create(
                                theString,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
        }
        else
        {
                return m_cdataSectionAllocator.create(
                                theString,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
        }
  }
  
  
  
  XalanSourceTreeComment*
  XalanSourceTreeDocument::createCommentNode(
                        const XalanDOMChar*                     data,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        return m_commentAllocator.create(
                                m_stringPool.get(data),
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
  }
  
  
  
  XalanSourceTreeProcessingInstruction*
  XalanSourceTreeDocument::createProcessingInstructionNode(
                        const XalanDOMChar*                     target,
                        const XalanDOMChar*                     data,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        assert(target != 0);
        assert(data != 0);
  
        return m_piAllocator.create(
                                m_stringPool.get(target),
                                m_stringPool.get(data),
                                this,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
  }
  
  
  
  XalanSourceTreeText*
  XalanSourceTreeDocument::createTextNode(
                        const XalanDOMChar*                     chars,
                        unsigned int                            length,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        assert(chars != 0);
  
        const XalanDOMString&   theString = m_stringPool.get(chars, length);
  
        if (isXMLWhitespace(theString) == true)
        {
                return m_textIWSAllocator.create(
                                theString,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
        }
        else
        {
                return m_textAllocator.create(
                                theString,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
        }
  }
  
  
  
  XalanSourceTreeText*
  XalanSourceTreeDocument::createTextIWSNode(
                        const XalanDOMChar*                     chars,
                        unsigned int                            length,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        assert(chars != 0);
  
        return m_textIWSAllocator.create(
                        m_stringPool.get(chars, length),
                        theParentElement,
                        thePreviousSibling,
                        theNextSibling,
                        m_nextIndexValue++);
  }
  
  
  
  void
  XalanSourceTreeDocument::unparsedEntityDecl(
                        const XMLCh*    name,
                        const XMLCh*    publicId,
                        const XMLCh*    systemId,
                        const XMLCh*    notationName)
  {
        m_unparsedEntityURIs[XalanDOMString(name)] = XalanDOMString(systemId);
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDocument::getUnparsedEntityURI(const XalanDOMString&           
theName) const
  {
        const UnparsedEntityURIMapType::const_iterator  i =
                m_unparsedEntityURIs.find(theName);
  
        if (i != m_unparsedEntityURIs.end())
        {
                return (*i).second;
        }
        else
        {
                return s_emptyString;
        }
  }
  
  
  
  #if 0
  // Commented out for now, since we need a way to get namespace URIs.  (Like 
Stylesheet does).
  XalanSourceTreeAttr*
  XalanSourceTreeDocument::createAttribute(
                        const XalanDOMChar*                     theName,
                        const XalanDOMChar*                     theValue,
                        XalanSourceTreeElement*         theOwnerElement)
  {
        const unsigned int      theLength = length(theName);
        const unsigned int      theColonIndex = indexOf(theName, 
XalanUnicode::charColon);
  
        if (theColonIndex == theLength)
        {
                return m_attributeAllocator.create(
                                m_stringPool.get(theName),
                                m_stringPool.get(theValue),
                                theOwnerElement,
                                m_nextIndexValue++);
        }
        else
        {
                // The constructor parameters for AttrNS are:
                //
                // name
                // local name
                // namespace URI
                // prefix
                // value
                // owner element
                // index
                //
                return m_attributeNSAllocator.create(
                                m_stringPool.get(theName, theLength),
                                m_stringPool.get(theName, theColonIndex),
                                m_stringPool.get(XalanDOMString()),
                                m_stringPool.get(theName + theColonIndex, 
theLength - theColonIndex),
                                m_stringPool.get(theValue),
                                theOwnerElement,
                                m_nextIndexValue++);
        }
  
        return 0;
  }
  
  
  
  // Commented out for now, since we need a way to get namespace URIs.  (Like 
Stylesheet does).
  XalanSourceTreeElement*
  XalanSourceTreeDocument::createElement(
                        const XalanDOMChar*                     theTagName,
                        XalanSourceTreeAttr**           theAttributeVector,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling)
  {
        const unsigned int      theLength = length(theTagName);
        const unsigned int      theColonIndex = indexOf(theTagName, 
XalanUnicode::charColon);
  
        if (theColonIndex == theLength)
        {
                return m_elementAllocator.create(
                                m_stringPool.get(theTagName),
                                this,
                                theAttributeVector,
                                theAttributeCount,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
        }
        else
        {
                // The constructor parameters for ElementNS are:
                //
                // tag name
                // local name
                // namespace URI
                // prefix
                // owner document
                // attributes
                // attribute count
                // parent element
                // previous sibling
                // next sibling
                // index
                //
                return m_elementNSAllocator.create(
                                m_stringPool.get(theTagName, theLength),
                                m_stringPool.get(theTagName + theColonIndex + 
1, theColonIndex),
                                // How do we get the namespace for the prefix?
                                m_stringPool.get(XalanDOMString()),
                                m_stringPool.get(theTagName,),
                                this,
                                theAttributeVector,
                                theAttributeCount,
                                theParentElement,
                                thePreviousSibling,
                                theNextSibling,
                                m_nextIndexValue++);
        }
  
        return 0;
  }
  #endif
  
  
  
  void
  XalanSourceTreeDocument::createAttributes(
                        const Attributes&                       theAttributes,
                        XalanSourceTreeAttr**           theAttributeVector,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theOwnerElement)
  {
        // Now, create the attributes...
        for(unsigned int i = 0; i < theAttributeCount; ++i)
        {
                const XalanDOMChar* const       theQName =
                        theAttributes.getQName(i);
                assert(theQName != 0);
  
                const XalanDOMChar* const       theValue =
                        theAttributes.getValue(i);
                assert(theValue != 0);
  
                const XalanDOMChar* const       theURI =
                        theAttributes.getURI(i);
  
  #if 1
                if (equals(theURI, XALAN_STATIC_UCODE_STRING("EMPTY")) == true)
  #else
                if (theURI == 0 || length(theURI) == 0)
  #endif
                {
                        theAttributeVector[i] =
                                m_attributeAllocator.create(
                                        m_stringPool.get(theQName),
                                        m_stringPool.get(theValue),
                                        theOwnerElement,
                                        m_nextIndexValue++);
                }
                else
                {
                        const XalanDOMChar* const       theLocalName =
                                theAttributes.getLocalName(i);
                        assert(theLocalName != 0);
  
                        const unsigned int      theColonIndex = 
indexOf(theQName, XalanUnicode::charColon);
                        assert(theColonIndex != length(theQName));
  
                        // The constructor parameters for AttrNS are:
                        //
                        // name
                        // local name
                        // namespace URI
                        // prefix
                        // value
                        // owner element
                        // index
                        //
                        theAttributeVector[i] =
                                m_attributeNSAllocator.create(
                                                m_stringPool.get(theQName),
                                                m_stringPool.get(theLocalName),
                                                m_stringPool.get(theURI),
                                                // This is the prefix...
                                                m_stringPool.get(theQName, 
theColonIndex),
                                                m_stringPool.get(theValue),
                                                theOwnerElement,
                                                m_nextIndexValue++);
                }
  
                // OK, now let's see if we have an ID attribute...
                const XalanDOMChar*             theType =
                        theAttributes.getType(i);
  
                // Look for an attribute that was declared as type ID in the 
DTD.
                // Note that we can just save a pointer to the attribute's 
XalanDOMString
                // data, since the attribute is guaranteed to exist for as long 
as the
                // document does.
                if (*theType == XalanUnicode::charLetter_I &&
                        *++theType == XalanUnicode::charLetter_D &&
                        *++theType == 0)
                {
                        
m_elementsByID[c_wstr(theAttributeVector[i]->getValue())] = theOwnerElement;
                }
        }
  }
  
  
  
  void
  XalanSourceTreeDocument::setDocumentElement(XalanSourceTreeElement*           
theElement)
  {
        if (m_documentElement != 0)
        {
                throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
        }
        else
        {
                m_documentElement = theElement;
  
                XalanSourceTreeHelper::appendSibling(this, m_firstChild, 
theElement);
        }
  }
  
  
  
  void
  XalanSourceTreeDocument::appendChildNode(XalanSourceTreeElement*      
theChild)
  {
        if (m_documentElement != 0)
        {
                throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
        }
        else
        {
                m_documentElement = theChild;
  
                XalanSourceTreeHelper::appendSibling(this, m_firstChild, 
theChild);
        }
  }
  
  
  
  void
  
XalanSourceTreeDocument::appendChildNode(XalanSourceTreeProcessingInstruction*  
      theChild)
  {
        XalanSourceTreeHelper::appendSibling(this, m_firstChild, theChild);
  }
  
  
  
  static XalanDOMString s_nameString;
  
  
  
  const XalanDOMString& XalanSourceTreeDocument::s_nameString = ::s_nameString;
  
  
  
  void
  XalanSourceTreeDocument::initialize()
  {
        ::s_nameString = XALAN_STATIC_UCODE_STRING("#document");
  }
  
  
  
  void
  XalanSourceTreeDocument::terminate()
  {
        clear(::s_nameString);
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDocument.hpp
  
  Index: XalanSourceTreeDocument.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *      if any, must include the following acknowledgment:  
   *             "This product includes software developed by the
   *              Apache Software Foundation (http://www.apache.org/)."
   *      Alternately, this acknowledgment may appear in the software itself,
   *      if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *      not be used to endorse or promote products derived from this
   *      software without prior written permission. For written 
   *      permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *      nor may "Apache" appear in their name, without prior written
   *      permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.        IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680)
  #define XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <map>
  
  
  
  #include <XalanDOM/XalanDocument.hpp>
  #include <XalanDOM/XalanNodeListSurrogate.hpp>
  
  
  
  #include <PlatformSupport/STLHelper.hpp>
  #include <PlatformSupport/XalanDOMStringPool.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeAttributeAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeAttributeNSAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeAttributesVector.hpp>
  #include <XalanSourceTree/XalanSourceTreeCommentAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeCDATASectionAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeCDATASectionIWSAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeElementAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeElementNSAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeTextAllocator.hpp>
  #include <XalanSourceTree/XalanSourceTreeTextIWSAllocator.hpp>
  
  
  
  class AttributeList;
  class Attributes;
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeDocument : public 
XalanDocument
  {
  public:
  
  #if defined (XALAN_NO_NAMESPACES)
        typedef map<
                                const XalanDOMChar*,
                                XalanSourceTreeElement*,
                                less_null_terminated_arrays<XalanDOMChar> >     
        ElementByIDMapType;
  
        typedef map<
                                XalanDOMString,
                                XalanDOMString,
                                less<XalanDOMString> >                          
                        UnparsedEntityURIMapType;
  #else
        typedef std::map<
                                const XalanDOMChar*,
                                XalanSourceTreeElement*,
                                less_null_terminated_arrays<XalanDOMChar> >     
        ElementByIDMapType;
  
        typedef std::map<
                                XalanDOMString,
                                XalanDOMString>                                 
                                UnparsedEntityURIMapType;
  #endif
  
        /**
         * Perform static initialization.  See class XalanSourceTreeInit.
         */
        static void
        initialize();
  
        /**
         * Perform static shut down.  See class XalanSourceTreeInit.
         */
        static void
        terminate();
  
  
        /**
         *
         * Constructor for XalanSourceTreeDocument.
         *
         * @param fDynamic If true, the document will allow dynamic building 
through _some_ of the standard DOM APIs
         *
         */
        XalanSourceTreeDocument(bool    fDynamic = false);
  
        virtual
        ~XalanSourceTreeDocument();
  
        // These interfaces are inherited from XalanNode...
  
        virtual const XalanDOMString&
        getNodeName() const;
  
        virtual const XalanDOMString&
        getNodeValue() const;
  
        virtual NodeType
        getNodeType() const;
  
        virtual XalanNode*
        getParentNode() const;
  
        virtual const XalanNodeList*
        getChildNodes() const;
  
        virtual XalanNode*
        getFirstChild() const;
  
        virtual XalanNode*
        getLastChild() const;
  
        virtual XalanNode*
        getPreviousSibling() const;
  
        virtual XalanNode*
        getNextSibling() const;
  
        virtual const XalanNamedNodeMap*
        getAttributes() const;
  
        virtual XalanDocument*
        getOwnerDocument() const;
  
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
        virtual XalanNode*
  #else
        virtual XalanSourceTreeDocument*
  #endif
        cloneNode(bool deep) const;
  
        virtual XalanNode*
        insertBefore(
                        XalanNode*      newChild,
                        XalanNode*      refChild);
  
        virtual XalanNode*
        replaceChild(
                        XalanNode*      newChild,
                        XalanNode*      oldChild);
  
        virtual XalanNode*
        removeChild(XalanNode*  oldChild);
  
        virtual XalanNode*
        appendChild(XalanNode*  newChild);
  
        virtual bool
        hasChildNodes() const;
  
        virtual void
        setNodeValue(const XalanDOMString&              nodeValue);
  
        virtual void
        normalize();
  
        virtual bool
        supports(
                        const XalanDOMString&   feature,
                        const XalanDOMString&   version) const;
  
        virtual const XalanDOMString&
        getNamespaceURI() const;
  
        virtual const XalanDOMString&
        getPrefix() const;
  
        virtual const XalanDOMString&
        getLocalName() const;
  
        virtual void
        setPrefix(const XalanDOMString& prefix);
  
        virtual bool
        isIndexed() const;
  
        virtual unsigned long
        getIndex() const;
  
        virtual XalanElement*
        createElement(const XalanDOMString& tagName);
  
        virtual XalanDocumentFragment*
        createDocumentFragment();
  
        virtual XalanText*
        createTextNode(const XalanDOMString&    data);
  
        virtual XalanComment*
        createComment(const XalanDOMString& data);
  
        virtual XalanCDATASection*
        createCDATASection(const XalanDOMString&        data);
  
        virtual XalanProcessingInstruction*
        createProcessingInstruction(
                        const XalanDOMString&   target,
                        const XalanDOMString&   data);
  
        virtual XalanAttr*
        createAttribute(const XalanDOMString&   name);
  
        virtual XalanEntityReference*
        createEntityReference(const XalanDOMString& name);
  
        virtual XalanDocumentType*
        getDoctype() const;
  
        virtual XalanDOMImplementation*
        getImplementation() const;
  
        virtual XalanElement*
        getDocumentElement() const;
  
        virtual XalanNodeList*
        getElementsByTagName(const XalanDOMString&              tagname) const;
  
        virtual XalanNode*
        importNode(
                        XalanNode*      importedNode,
                        bool            deep);
  
        virtual XalanElement*
        createElementNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   qualifiedName);
  
        virtual XalanAttr*
        createAttributeNS(
                        const XalanDOMString& namespaceURI,
                        const XalanDOMString& qualifiedName);
  
        virtual XalanNodeList*
        getElementsByTagNameNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName) const;
  
        virtual XalanElement*
        getElementById(const XalanDOMString&    elementId) const;
  
  
        // Interfaces not inherited from XalanDocument...
  
        XalanSourceTreeElement*
        createElementNode(
                        const XalanDOMChar*                     name,
                        const AttributeList&            attrs,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0);
  
        XalanSourceTreeElement*
        createElementNode(
                        const XalanDOMChar*                     uri,
                        const XalanDOMChar*                     localname,
                        const XalanDOMChar*                     qname,
                        const Attributes&                       attrs,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0);
  
        XalanSourceTreeElement*
        createElementNode(
                        const XalanDOMChar*                     name,
                        const Attributes&                       attrs,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0);
  
        XalanSourceTreeCDATASection*
        createCDATASectionNode(
                        const XalanDOMChar*                     chars,
                        unsigned int                            length,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0);
  
        XalanSourceTreeComment*
        createCommentNode(
                        const XalanDOMChar*                     data,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0);
  
        XalanSourceTreeProcessingInstruction*
        createProcessingInstructionNode(
                        const XalanDOMChar*                     target,
                        const XalanDOMChar*                     data,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0);
  
        XalanSourceTreeText*
        createTextNode(
                        const XalanDOMChar*                     chars,
                        unsigned int                            length,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0);
  
        XalanSourceTreeText*
        createTextIWSNode(
                        const XalanDOMChar*                     chars,
                        unsigned int                            length,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0);
  
        void
        unparsedEntityDecl(
                        const XMLCh*    name,
                        const XMLCh*    publicId,
                        const XMLCh*    systemId,
                        const XMLCh*    notationName);
  
        const XalanDOMString&
        getUnparsedEntityURI(const XalanDOMString&      theName) const;
  
        // Child node setters...
        void
        setDocumentElement(XalanSourceTreeElement*      theElement);
  
        void
        appendChildNode(XalanSourceTreeElement*         theChild);
  
        void
        appendChildNode(XalanSourceTreeProcessingInstruction*   theChild);
  
  private:
  
        // Helper functions...
        XalanSourceTreeAttr*
        createAttribute(
                        const XalanDOMChar*                     theName,
                        const XalanDOMChar*                     theValue,
                        XalanSourceTreeElement*         theOwnerElement);
  
        XalanSourceTreeElement*
        createElement(
                        const XalanDOMChar*                     theTagName,
                        XalanSourceTreeAttr**           theAttributeVector,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling);
  
        void
        createAttributes(
                        const Attributes&                       theAttributes,
                        XalanSourceTreeAttr**           theAttributeVector,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theOwnerElement);
  
        // Not implemented...
        XalanSourceTreeDocument(const XalanSourceTreeDocument&  theSource);
  
        XalanSourceTreeDocument&
        operator=(const XalanSourceTreeDocument&        theRHS);
  
        bool
        operator==(const XalanSourceTreeDocument&       theRHS) const;
  
  
        // Data members...
        XalanNode*                                                              
                m_firstChild;
  
        XalanSourceTreeElement*                                                 
m_documentElement;
  
        XalanNodeListSurrogate                                                  
m_children;
  
        XalanSourceTreeAttributeAllocator                               
m_attributeAllocator;
  
        XalanSourceTreeAttributeNSAllocator                             
m_attributeNSAllocator;
  
        XalanSourceTreeCommentAllocator                                 
m_commentAllocator;
  
        XalanSourceTreeCDATASectionAllocator                    
m_cdataSectionAllocator;
  
        XalanSourceTreeCDATASectionIWSAllocator                 
m_cdataSectionIWSAllocator;
  
        XalanSourceTreeElementAllocator                                 
m_elementAllocator;
  
        XalanSourceTreeElementNSAllocator                               
m_elementNSAllocator;
  
        XalanSourceTreeProcessingInstructionAllocator   m_piAllocator;
  
        XalanSourceTreeTextAllocator                                    
m_textAllocator;
  
        XalanSourceTreeTextIWSAllocator                                 
m_textIWSAllocator;
  
        XalanDOMStringPool                                                      
        m_stringPool;
  
        XalanSourceTreeAttributesVector                                 
m_attributesVector;
  
        unsigned int                                                            
        m_nextIndexValue;
  
        const bool                                                              
                m_dynamic;
  
        ElementByIDMapType                                                      
        m_elementsByID;
  
        UnparsedEntityURIMapType                                                
m_unparsedEntityURIs;
  
        static const XalanDOMString&                                    
s_nameString;
  };
  
  
  
  #endif        // !defined(XALANSOURCETREEDOCUMENT_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDOMSupport.cpp
  
  Index: XalanSourceTreeDOMSupport.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeDOMSupport.hpp"
  
  
  
  #include <XalanDOM/XalanNode.hpp>
  #include <XalanDOM/XalanAttr.hpp>
  #include <XalanDOM/XalanDocument.hpp>
  #include <XalanDOM/XalanElement.hpp>
  
  
  
  #include <PlatformSupport/DOMStringHelper.hpp>
  
  
  
  #include <DOMSupport/DOMServices.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDocument.hpp>
  #include <XalanSourceTree/XalanSourceTreeParserLiaison.hpp>
  
  
  
  static const XalanDOMString           s_emptyString;
  
  
  
  XalanSourceTreeDOMSupport::XalanSourceTreeDOMSupport() :
        DOMSupport(),
        m_domSupportDefault(),
        m_parserLiaison(0)
  {
  }
  
  
  
  XalanSourceTreeDOMSupport::~XalanSourceTreeDOMSupport()
  {
  }
  
  
  
  void
  XalanSourceTreeDOMSupport::reset()
  {
        m_domSupportDefault.reset();
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDOMSupport::getNamespaceOfNode(const XalanNode&        
theNode) const
  {
        return theNode.getNamespaceURI();
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDOMSupport::getExpandedElementName(const XalanElement& elem) 
const
  {
        return m_domSupportDefault.getExpandedElementName(elem);
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeDOMSupport::getExpandedAttributeName(const XalanAttr&  attr) 
const
  {
        return m_domSupportDefault.getExpandedAttributeName(attr);
  }
  
  
  const XalanDOMString&
  XalanSourceTreeDOMSupport::getUnparsedEntityURI(
                        const XalanDOMString&   theName,
                        const XalanDocument&    theDocument) const
  {
        if (m_parserLiaison != 0)
        {
                const XalanSourceTreeDocument* const    theXSTDocument =
                        m_parserLiaison->mapDocument(&theDocument);
  
                if (theXSTDocument != 0)
                {
                        return theXSTDocument->getUnparsedEntityURI(theName);
                }
        }
  
        return s_emptyString;
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeDOMSupport.hpp
  
  Index: XalanSourceTreeDOMSupport.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREEDOMSUPPORT_HEADER_GUARD_1357924680)
  #define XALANSOURCETREEDOMSUPPORT_HEADER_GUARD_1357924680
  
  
  
  // Base include file.  Must be first.
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <DOMSupport/DOMSupport.hpp>
  #include <DOMSupport/DOMSupportDefault.hpp>
  
  
  
  class XalanSourceTreeParserLiaison;
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeDOMSupport : public 
DOMSupport
  {
  public:
  
        XalanSourceTreeDOMSupport();
  
        virtual
        ~XalanSourceTreeDOMSupport();
  
        virtual void
        reset();
  
        // These interfaces are inherited from DOMSupport...
  
        virtual const XalanDOMString&
        getNamespaceOfNode(const XalanNode&             theNode) const;
  
        virtual const XalanDOMString&
        getExpandedElementName(const XalanElement&      elem) const;
  
        virtual const XalanDOMString&
        getExpandedAttributeName(const XalanAttr&       attr) const;
  
        virtual const XalanDOMString&
        getUnparsedEntityURI(
                        const XalanDOMString&   theName,
                        const XalanDocument&    theDocument) const;
  
  
        XalanSourceTreeParserLiaison*
        getParserLiaison() const
        {
                return m_parserLiaison;
        }
  
        void
        setParserLiaison(XalanSourceTreeParserLiaison*  theParserLiaison)
        {
                m_parserLiaison = theParserLiaison;
        }
  
  private:
  
        DOMSupportDefault                               m_domSupportDefault;
  
        XalanSourceTreeParserLiaison*   m_parserLiaison;
  };
  
  
  
  #endif        // XALANSOURCETREEDOMSUPPORT_HEADER_GUARD_1357924680
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElement.cpp
  
  Index: XalanSourceTreeElement.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeElement.hpp"
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  #include <PlatformSupport/DOMStringHelper.hpp>
  
  
  
  #include "XalanSourceTreeAttr.hpp"
  #include "XalanSourceTreeComment.hpp"
  #include "XalanSourceTreeCDATASection.hpp"
  #include "XalanSourceTreeDocument.hpp"
  #include "XalanSourceTreeProcessingInstruction.hpp"
  #include "XalanSourceTreeText.hpp"
  #include "XalanSourceTreeHelper.hpp"
  
  
  
  static const XalanDOMString           s_emptyString;
  
  
  
  XalanSourceTreeElement::XalanSourceTreeElement(
                        const XalanDOMString&           theTagName,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeAttr**           theAttributes,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex) :
        XalanElement(),
        m_tagName(theTagName),
        m_ownerDocument(theOwnerDocument),
        m_parentElement(theParentElement),
        m_previousSibling(thePreviousSibling),
        m_nextSibling(theNextSibling),
        m_firstChild(0),
        m_index(theIndex),
        m_attributes(theAttributes),
        m_attributeCount(theAttributeCount),
        m_childList(*this),
        m_attributeNamedNodeMap(this)
  {
  }
  
  
  
  XalanSourceTreeElement::~XalanSourceTreeElement()
  {
  }
  
  
  
  XalanSourceTreeElement::XalanSourceTreeElement(
                        const XalanSourceTreeElement&   theSource,
                        bool                                                    
/* deep */) :
        XalanElement(theSource),
        m_tagName(theSource.m_tagName),
        m_ownerDocument(theSource.m_ownerDocument),
        m_parentElement(0),
        m_previousSibling(0),
        m_nextSibling(0),
        m_firstChild(0),
        m_index(0),
        m_attributes(theSource.m_attributes),
        m_attributeCount(theSource.m_attributeCount),
        m_childList(*this),
        m_attributeNamedNodeMap(this)
  {
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElement::getNodeName() const
  {
        return m_tagName;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElement::getNodeValue() const
  {
        return s_emptyString;
  }
  
  
  
  XalanSourceTreeElement::NodeType
  XalanSourceTreeElement::getNodeType() const
  {
        return ELEMENT_NODE;
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::getParentNode() const
  {
        if (m_parentElement != 0)
        {
                return m_parentElement;
        }
        else
        {
                return m_ownerDocument;
        }
  }
  
  
  
  const XalanNodeList*
  XalanSourceTreeElement::getChildNodes() const
  {
        return &m_childList;
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::getFirstChild() const
  {
        return m_firstChild;
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::getLastChild() const
  {
        return XalanSourceTreeHelper::getLastSibling(m_firstChild);
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::getPreviousSibling() const
  {
        return m_previousSibling;
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::getNextSibling() const
  {
        return m_nextSibling;
  }
  
  
  
  const XalanNamedNodeMap*
  XalanSourceTreeElement::getAttributes() const
  {
        return &m_attributeNamedNodeMap;
  }
  
  
  
  XalanDocument*
  XalanSourceTreeElement::getOwnerDocument() const
  {
        return m_ownerDocument;
  }
  
  
  
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
  XalanNode*
  #else
  XalanSourceTreeElement*
  #endif
  XalanSourceTreeElement::cloneNode(bool        deep) const
  {
        return new XalanSourceTreeElement(*this, deep);
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::insertBefore(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* refChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::replaceChild(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::removeChild(XalanNode*        /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeElement::appendChild(XalanNode*        /* newChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  bool
  XalanSourceTreeElement::hasChildNodes() const
  {
        return m_firstChild != 0 ? true : false;
  }
  
  
  
  void
  XalanSourceTreeElement::setNodeValue(const XalanDOMString&            /* 
nodeValue */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeElement::normalize()
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeElement::supports(
                        const XalanDOMString&   /* feature */,
                        const XalanDOMString&   /* version */) const
  {
        return false;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElement::getNamespaceURI() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElement::getPrefix() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElement::getLocalName() const
  {
        return s_emptyString;
  }
  
  
  
  void
  XalanSourceTreeElement::setPrefix(const XalanDOMString&       /* prefix */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeElement::isIndexed() const
  {
        return true;
  }
  
  
  
  unsigned long
  XalanSourceTreeElement::getIndex() const
  {
        return m_index;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElement::getTagName() const
  {
        return m_tagName;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElement::getAttribute(const XalanDOMString&            name) 
const
  {
        XalanAttr* const        theAttr = getAttributeNode(name);
  
        return theAttr == 0 ? s_emptyString : theAttr->getValue();
  }
  
  
  
  XalanAttr*
  XalanSourceTreeElement::getAttributeNode(const XalanDOMString&                
name) const
  {
        for(unsigned int i = 0; i < m_attributeCount; ++i)
        {
                assert(m_attributes[i] != 0);
  
                if (equals(m_attributes[i]->getNodeName(), name) == true)
                {
                        return m_attributes[i];
                }
        }
  
        return 0;
  }
  
  
  
  XalanNodeList*
  XalanSourceTreeElement::getElementsByTagName(const XalanDOMString&    /* name 
*/) const
  {
        return 0;
  }
  
  
  
  void
  XalanSourceTreeElement::setAttribute(
                        const XalanDOMString&   /* name */,
                        const XalanDOMString&   /* value */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  XalanAttr*
  XalanSourceTreeElement::setAttributeNode(XalanAttr*           /* newAttr */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanAttr*
  XalanSourceTreeElement::removeAttributeNode(XalanAttr*        /* oldAttr */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  void
  XalanSourceTreeElement::removeAttribute(const XalanDOMString& /* name */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElement::getAttributeNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName) const
  {
        XalanAttr* const        theAttr = getAttributeNodeNS(namespaceURI, 
localName);
  
        return theAttr == 0 ? s_emptyString : theAttr->getValue();
  }
  
  
  
  void
  XalanSourceTreeElement::setAttributeNS(
                        const XalanDOMString&   /* namespaceURI */,
                        const XalanDOMString&   /* qualifiedName */,
                        const XalanDOMString&   /* value */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeElement::removeAttributeNS(
                        const XalanDOMString&   /* namespaceURI */,
                        const XalanDOMString&   /* localName */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  XalanAttr*
  XalanSourceTreeElement::getAttributeNodeNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName) const
  {
        for(unsigned int i = 0; i < m_attributeCount; ++i)
        {
                assert(m_attributes[i] != 0);
  
                if (equals(m_attributes[i]->getLocalName(), localName) == true 
&&
                        equals(m_attributes[i]->getNamespaceURI(), 
namespaceURI) == true)
                {
                        return m_attributes[i];
                }
        }
  
        return 0;
  }
  
  
  
  XalanAttr*
  XalanSourceTreeElement::setAttributeNodeNS(XalanAttr* /* newAttr */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNodeList*
  XalanSourceTreeElement::getElementsByTagNameNS(
                        const XalanDOMString&   /* namespaceURI */,
                        const XalanDOMString&   /* localName */) const
  {
        return 0;
  }
  
  
  
  void
  XalanSourceTreeElement::setPreviousSibling(XalanSourceTreeComment*    
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeElement::setPreviousSibling(XalanSourceTreeCDATASection*       
        thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeElement::setPreviousSibling(XalanSourceTreeElement*    
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  
XalanSourceTreeElement::setPreviousSibling(XalanSourceTreeProcessingInstruction*
      thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeElement::setPreviousSibling(XalanSourceTreeText*               
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeElement::appendSiblingNode(XalanSourceTreeComment*     
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeElement::appendSiblingNode(XalanSourceTreeCDATASection*        
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeElement::appendSiblingNode(XalanSourceTreeElement*     
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  
XalanSourceTreeElement::appendSiblingNode(XalanSourceTreeProcessingInstruction* 
              theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeElement::appendSiblingNode(XalanSourceTreeText*        
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeElement::appendChildNode(XalanSourceTreeComment*               
theChild)
  {
        XalanSourceTreeHelper::appendSiblingToChild(this, m_firstChild, 
theChild);
  }
  
  
  
  void
  XalanSourceTreeElement::appendChildNode(XalanSourceTreeCDATASection*  
theChild)
  {
        XalanSourceTreeHelper::appendSiblingToChild(this, m_firstChild, 
theChild);
  }
  
  
  
  void
  XalanSourceTreeElement::appendChildNode(XalanSourceTreeElement*               
theChild)
  {
        XalanSourceTreeHelper::appendSiblingToChild(this, m_firstChild, 
theChild);
  }
  
  
  
  void
  XalanSourceTreeElement::appendChildNode(XalanSourceTreeProcessingInstruction* 
theChild)
  {
        XalanSourceTreeHelper::appendSiblingToChild(this, m_firstChild, 
theChild);
  }
  
  
  
  void
  XalanSourceTreeElement::appendChildNode(XalanSourceTreeText*  theChild)
  {
        XalanSourceTreeHelper::appendSiblingToChild(this, m_firstChild, 
theChild);
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElement.hpp
  
  Index: XalanSourceTreeElement.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREEELEMENT_HEADER_GUARD_1357924680)
  #define XALANSOURCETREEELEMENT_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanDOM/XalanDOMString.hpp>
  #include <XalanDOM/XalanElement.hpp>
  #include <XalanDOM/XalanNodeListSurrogate.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeNamedNodeMap.hpp>
  
  
  
  class XalanSourceTreeAttr;
  class XalanSourceTreeCDATASection;
  class XalanSourceTreeComment;
  class XalanSourceTreeDocument;
  class XalanSourceTreeProcessingInstruction;
  class XalanSourceTreeText;
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElement : public 
XalanElement
  {
  public:
  
        /**
         * Constructor.
         *
         * @param theTagName The tag name of the element
         * @param theOwnerDocument The document that owns the instance
         * @param theAttributes An array of pointers to the attribute instances 
for the element
         * @param theAttributeCount The number of attributes.
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The previous sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         */
        XalanSourceTreeElement(
                        const XalanDOMString&           theTagName,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeAttr**           theAttributes,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        virtual
        ~XalanSourceTreeElement();
  
  
        /**
         * Gets the name of this node.
         */
        virtual const XalanDOMString&
        getNodeName() const;
  
        /**
         * Gets the value of this node, depending on its type.
         */
        virtual const XalanDOMString&
        getNodeValue() const;
  
        /**
         * An enum value representing the type of the underlying object.
         */
        virtual NodeType
        getNodeType() const;
  
        /**
         * Gets the parent of this node.
         *
         * All nodes, except <code>Document</code>,
         * <code>DocumentFragment</code>, and <code>Attr</code> may have a 
parent.
         * However, if a node has just been created and not yet added to the 
tree,
         * or if it has been removed from the tree, a <code>null</code> DOM_Node
         * is returned.
         */
        virtual XalanNode*
        getParentNode() const;
  
        /**
         * Gets a <code>NodeList</code> that contains all children of this node.
         *
         * If there
         * are no children, this is a <code>NodeList</code> containing no nodes.
         * The content of the returned <code>NodeList</code> is "live" in the 
sense
         * that, for instance, changes to the children of the node object that
         * it was created from are immediately reflected in the nodes returned 
by
         * the <code>NodeList</code> accessors; it is not a static snapshot of 
the
         * content of the node. This is true for every <code>NodeList</code>,
         * including the ones returned by the <code>getElementsByTagName</code>
         * method.
         */
        virtual const XalanNodeList*
        getChildNodes() const;
  
        /**
         * Gets the first child of this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getFirstChild() const;
  
        /**
         * Gets the last child of this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getLastChild() const;
  
        /**
         * Gets the node immediately preceding this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getPreviousSibling() const;
  
        /**
         * Gets the node immediately following this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getNextSibling() const;
  
        /**
         * Gets a <code>NamedNodeMap</code> containing the attributes of this 
node (if it
         * is an <code>Element</code>) or <code>null</code> otherwise.
         */
        virtual const XalanNamedNodeMap*
        getAttributes() const;
  
        /**
         * Gets the <code>DOM_Document</code> object associated with this node.
         *
         * This is also
         * the <code>DOM_Document</code> object used to create new nodes. When 
this
         * node is a <code>DOM_Document</code> or a 
<code>DOM_DocumentType</code>
         * which is not used with any <code>DOM_Document</code> yet, this is
         * <code>null</code>.
         */
        virtual XalanDocument*
        getOwnerDocument() const;
  
        //@}
        /** @name Cloning function. */
        //@{
  
        /**
         * Returns a duplicate of this node.
         *
         * This function serves as a generic copy constructor for nodes.
         *
         * The duplicate node has no parent (
         * <code>parentNode</code> returns <code>null</code>.).
         * <br>Cloning an <code>Element</code> copies all attributes and their
         * values, including those generated by the  XML processor to represent
         * defaulted attributes, but this method does not copy any text it 
contains
         * unless it is a deep clone, since the text is contained in a child
         * <code>Text</code> node. Cloning any other type of node simply 
returns a
         * copy of this node.
         * @param deep If <code>true</code>, recursively clone the subtree 
under the
         *       specified node; if <code>false</code>, clone only the node 
itself (and
         *       its attributes, if it is an <code>Element</code>).
         * @return The duplicate node.
         */
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
        virtual XalanNode*
  #else
        virtual XalanSourceTreeElement*
  #endif
        cloneNode(bool deep) const;
  
        //@}
        /** @name Functions to modify the DOM Node. */
        //@{
  
        /**
         * Inserts the node <code>newChild</code> before the existing child node
         * <code>refChild</code>.
         *
         * If <code>refChild</code> is <code>null</code>,
         * insert <code>newChild</code> at the end of the list of children.
         * <br>If <code>newChild</code> is a <code>DocumentFragment</code> 
object,
         * all of its children are inserted, in the same order, before
         * <code>refChild</code>. If the <code>newChild</code> is already in the
         * tree, it is first removed.  Note that a <code>DOM_Node</code> that
         * has never been assigned to refer to an actual node is == null.
         * @param newChild The node to insert.
         * @param refChild The reference node, i.e., the node before which the 
new
         *       node must be inserted.
         * @return The node being inserted.
         */
        virtual XalanNode*
        insertBefore(
                        XalanNode*      newChild,
                        XalanNode*      refChild);
  
        /**
         * Replaces the child node <code>oldChild</code> with 
<code>newChild</code>
         * in the list of children, and returns the <code>oldChild</code> node.
         *
         * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> 
object,
         * <CODE>oldChild</CODE> is replaced by all of the 
<CODE>DOM_DocumentFragment</CODE>
         * children, which are inserted in the same order.
         *
         * If the <code>newChild</code> is already in the tree, it is first 
removed.
         * @param newChild The new node to put in the child list.
         * @param oldChild The node being replaced in the list.
         * @return The node replaced.
         */
        virtual XalanNode*
        replaceChild(
                        XalanNode*      newChild,
                        XalanNode*      oldChild);
  
        /**
         * Removes the child node indicated by <code>oldChild</code> from the 
list
         * of children, and returns it.
         *
         * @param oldChild The node being removed.
         * @return The node removed.
         */
        virtual XalanNode*
        removeChild(XalanNode*  oldChild);
  
        /**
         * Adds the node <code>newChild</code> to the end of the list of 
children of
         * this node.
         *
         * If the <code>newChild</code> is already in the tree, it is
         * first removed.
         * @param newChild The node to add.If it is a  
<code>DocumentFragment</code>
         *       object, the entire contents of the document fragment are moved 
into
         *       the child list of this node
         * @return The node added.
         */
        virtual XalanNode*
        appendChild(XalanNode*  newChild);
  
        //@}
        /** @name Query functions. */
        //@{
  
        /**
         *      This is a convenience method to allow easy determination of 
whether a
         * node has any children.
         *
         * @return      <code>true</code> if the node has any children,
         *       <code>false</code> if the node has no children.
         */
        virtual bool
        hasChildNodes() const;
  
  
        //@}
        /** @name Set functions. */
        //@{
  
  
        /**
        * Sets the value of the node.
        *
        * Any node which can have a nodeValue (@see getNodeValue) will
        * also accept requests to set it to a string. The exact response to
        * this varies from node to node -- Attribute, for example, stores
        * its values in its children and has to replace them with a new Text
        * holding the replacement value.
        *
        * For most types of Node, value is null and attempting to set it
        * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
        * also be thrown if the node is read-only.
        */
        virtual void
        setNodeValue(const XalanDOMString&              nodeValue);
  
        //@}
        /** @name Functions introduced in DOM Level 2. */
        //@{
  
        /**
         * Puts all <CODE>DOM_Text</CODE>
         * nodes in the full depth of the sub-tree underneath this 
<CODE>DOM_Node</CODE>, 
         * including attribute nodes, into a "normal" form where only markup 
(e.g., 
         * tags, comments, processing instructions, CDATA sections, and entity 
         * references) separates <CODE>DOM_Text</CODE>
         * nodes, i.e., there are no adjacent <CODE>DOM_Text</CODE>
         * nodes. This can be used to ensure that the DOM view of a document is 
the 
         * same as if it were saved and re-loaded, and is useful when 
operations 
         * (such as XPointer lookups) that depend on a particular document tree 
         * structure are to be used.
         * <P><B>Note:</B> In cases where the document contains 
<CODE>DOM_CDATASections</CODE>, 
         * the normalize operation alone may not be sufficient, since XPointers 
do 
         * not differentiate between <CODE>DOM_Text</CODE>
         * nodes and <CODE>DOM_CDATASection</CODE> nodes.</P>
         */
        virtual void
        normalize();
  
        /**
         * Tests whether the DOM implementation implements a specific
         * feature and that feature is supported by this node.
         * @param feature The string of the feature to test. This is the same
         * name as what can be passed to the method <code>hasFeature</code> on
         * <code>DOMImplementation</code>.
         * @param version This is the version number of the feature to test. In
         * Level 2, version 1, this is the string "2.0". If the version is not
         * specified, supporting any version of the feature will cause the
         * method to return <code>true</code>.
         * @return Returns <code>true</code> if the specified feature is 
supported
         * on this node, <code>false</code> otherwise.
         */
        virtual bool
        supports(
                        const XalanDOMString&   feature,
                        const XalanDOMString&   version) const;
  
        /**
         * Get the <em>namespace URI</em> of
         * this node, or <code>null</code> if it is unspecified.
         * <p>
         * This is not a computed value that is the result of a namespace lookup
         * based on an examination of the namespace declarations in scope. It is
         * merely the namespace URI given at creation time.
         * <p>
         * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and 
         * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 
method, 
         * such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
         * interface, this is always <CODE>null</CODE>.
         */
        virtual const XalanDOMString&
        getNamespaceURI() const;
  
        /**
         * Get the <em>namespace prefix</em>
         * of this node, or <code>null</code> if it is unspecified.
         */
        virtual const XalanDOMString&
        getPrefix() const;
  
        /**
         * Returns the local part of the <em>qualified name</em> of this node.
         * <p>
         * For nodes created with a DOM Level 1 method, such as
         * <code>createElement</code> from the <code>DOM_Document</code> 
interface,
         * it is null.
         */
        virtual const XalanDOMString&
        getLocalName() const;
  
        /**
         * Set the <em>namespace prefix</em> of this node.
         * <p>
         * Note that setting this attribute, when permitted, changes 
         * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified 
         * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE> 
         * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE>
         * interfaces, when applicable.
         * <p>
         * Note also that changing the prefix of an 
         * attribute, that is known to have a default value, does not make a 
new 
         * attribute with the default value and the original prefix appear, 
since the 
         * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
         *
         * @param prefix The prefix of this node.
         * @exception DOMException
         *       INVALID_CHARACTER_ERR: Raised if the specified prefix contains
         *                                                      an illegal 
character.
         * <br>
         *       NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         * <br>
         *       NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is 
         *               malformed, if the specified prefix is "xml" and the 
         *               <CODE>namespaceURI</CODE> of this node is different 
from 
         *               "http://www.w3.org/XML/1998/namespace";, if specified 
prefix is 
         *               "xmlns" and the <CODE>namespaceURI</CODE> is neither 
         *               <CODE>null</CODE> nor an empty string, or if the 
         *               <CODE>localName</CODE> is <CODE>null</CODE>.
         */
        virtual void
        setPrefix(const XalanDOMString& prefix);
  
        virtual bool
        isIndexed() const;
  
        virtual unsigned long
        getIndex() const;
  
        //@}
  
        // These interfaces are inherited from XalanElement...
  
        /**
         * The name of the element. 
         *
         * For example, in: &lt;elementExample 
         * id="demo"&gt;  ... &lt;/elementExample&gt; , <code>tagName</code> 
has 
         * the value <code>"elementExample"</code>. Note that this is 
         * case-preserving in XML, as are all of the operations of the DOM. 
         */
        virtual const XalanDOMString&
        getTagName() const;
  
        /**
         * Retrieves an attribute value by name.
         *
         * @param name The name of the attribute to retrieve.
         * @return The <code>DOM_Attr</code> value as a string, or the empty  
string if 
         *   that attribute does not have a specified or default value.
         */
        virtual const XalanDOMString&
        getAttribute(const XalanDOMString&              name) const;
  
        /**
         * Retrieves an <code>DOM_Attr</code> node by name.
         *
         * @param name The name (<CODE>nodeName</CODE>) of the attribute to 
retrieve.
         * @return The <code>DOM_Attr</code> node with the specified name 
(<CODE>nodeName</CODE>) or 
         *   <code>null</code> if there is no such attribute.
         */
        virtual XalanAttr*
        getAttributeNode(const XalanDOMString&          name) const;
  
        /**
         * Returns a <code>NodeList</code> of all descendant elements with a 
given 
         * tag name, in the order in which they would be encountered in a 
preorder 
         * traversal of the <code>DOM_Element</code> tree.  Caller is
         * responsible for deleting the XalanNodeList instance.
         *
         * @param name The name of the tag to match on. The special value "*" 
         *   matches all tags.
         * @return A list of matching <code>DOM_Element</code> nodes.
         */
        virtual XalanNodeList*
        getElementsByTagName(const XalanDOMString&      name) const;
  
        //@}
         /** @name Set functions. */
         //@{
  
        /**
         * Adds a new attribute. 
         * 
         * If an attribute with that name is already present 
         * in the element, its value is changed to be that of the value 
parameter. 
         * This value is a simple string, it is not parsed as it is being set. 
So 
         * any markup (such as syntax to be recognized as an entity reference) 
is 
         * treated as literal text, and needs to be appropriately escaped by 
the 
         * implementation when it is written out. In order to assign an 
attribute 
         * value that contains entity references, the user must create an 
         * <code>DOM_Attr</code> node plus any <code>Text</code> and 
         * <code>EntityReference</code> nodes, build the appropriate subtree, 
and 
         * use <code>setAttributeNode</code> to assign it as the value of an 
         * attribute.
         * @param name The name of the attribute to create or alter.
         * @param value Value to set in string form.
         * @exception DOMException
         *   INVALID_CHARACTER_ERR: Raised if the specified name contains an 
         *   illegal character.
         *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         */
        virtual void
        setAttribute(
                        const XalanDOMString&   name, 
                        const XalanDOMString&   value);
  
        /**
         * Adds a new attribute. 
         * 
         * If an attribute with that name (<CODE>nodeName</CODE>) is already 
present 
         * in the element, it is replaced by the new one.
         * @param newAttr The <code>DOM_Attr</code> node to add to the 
attribute list.
         * @return If the <code>newAttr</code> attribute replaces an existing 
       *   attribute, the replaced
       *   <code>DOM_Attr</code> node is returned, otherwise <code>null</code> 
is 
       *   returned.
       * @exception DOMException
       *   WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from 
a 
       *   different document than the one that created the element.
       *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
       *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already 
an 
       *   attribute of another <code>DOM_Element</code> object. The DOM user 
must 
       *   explicitly clone <code>DOM_Attr</code> nodes to re-use them in other 
       *   elements.
       */
        virtual XalanAttr*
        setAttributeNode(XalanAttr*             newAttr);
  
      //@}
      /** @name Functions which modify the Element. */
      //@{
      
        /**
         * Removes the specified attribute node.
         * If the removed <CODE>DOM_Attr</CODE>
         *   has a default value it is immediately replaced. The replacing 
attribute 
         *   has the same namespace URI and local name, as well as the original 
prefix, 
         *   when applicable.
         *
         * @param oldAttr The <code>DOM_Attr</code> node to remove from the 
attribute 
         *   list.
         * @return The <code>DOM_Attr</code> node that was removed.
         * @exception DOMException
         *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         *   <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an 
attribute 
         *   of the element.
         */
        virtual XalanAttr*
        removeAttributeNode(XalanAttr*  oldAttr);
  
        /**
         * Removes an attribute by name. 
         *
         * If the removed attribute 
         *   is known to have a default value, an attribute immediately appears 
         *   containing the default value as well as the corresponding 
namespace URI, 
         *   local name, and prefix when applicable.<BR>To remove an attribute 
by local 
         *   name and namespace URI, use the <CODE>removeAttributeNS</CODE> 
method.
         * @param name The name of the attribute to remove.
         * @exception DOMException
         *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         */
        virtual void
        removeAttribute(const XalanDOMString&   name);
  
        //@}
        /** @name Functions introduced in DOM Level 2. */
        //@{
  
        /**
         * Retrieves an attribute value by local name and namespace URI.
         *
         * @param namespaceURI The <em>namespace URI</em> of
         *    the attribute to retrieve.
         * @param localName The <em>local name</em> of the
         *    attribute to retrieve.
         * @return The <code>DOM_Attr</code> value as a string, or an empty 
string if
        *    that attribute does not have a specified or default value.
         */
        virtual const XalanDOMString&
        getAttributeNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName) const;
  
        /**
         * Adds a new attribute. If the given 
         *   <CODE>namespaceURI</CODE> is <CODE>null</CODE> or an empty string 
and the 
         *   <CODE>qualifiedName</CODE> has a prefix that is "xml", the new 
attribute 
         *   is bound to the predefined namespace 
         *   "http://www.w3.org/XML/1998/namespace";. 
         *   If an attribute with the same local name and namespace URI is 
already 
         *   present on the element, its prefix is changed to be the prefix 
part of the 
         *   <CODE>qualifiedName</CODE>, and its value is changed to be the 
         *   <CODE>value</CODE> parameter. 
         * This value is a simple string, it is
         * not parsed as it is being set. So any markup (such as syntax to be
         * recognized as an entity reference) is treated as literal text, and
         * needs to be appropriately escaped by the implementation when it is
         * written out. In order to assign an attribute value that contains 
entity
         * references, the user must create a <code>DOM_Attr</code> node plus 
any
         * <code>DOM_Text</code> and <code>DOM_EntityReference</code> nodes, 
build the
         * appropriate subtree, and use <code>setAttributeNodeNS</code> or
         * <code>setAttributeNode</code> to assign it as the value of an
         * attribute.
         * @param namespaceURI The <em>namespace URI</em> of
         *    the attribute to create or alter.
         * @param localName The <em>local name</em> of the
         *    attribute to create or alter.
         * @param value The value to set in string form.
         * @exception DOMException
         *   INVALID_CHARACTER_ERR: Raised if the specified qualified name 
contains an 
         *   illegal character.
         *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         * <br>
         *   NAMESPACE_ERR: Raised if the <CODE>qualifiedName</CODE> is 
         *         malformed, if the <CODE>qualifiedName</CODE> has a prefix 
that is 
         *         "xml" and the <CODE>namespaceURI</CODE> is neither 
<CODE>null</CODE> 
         *         nor an empty string nor 
"http://www.w3.org/XML/1998/namespace";, or 
         *         if the <CODE>qualifiedName</CODE> has a prefix that is 
"xmlns" but 
         *         the <CODE>namespaceURI</CODE> is neither <CODE>null</CODE> 
nor an 
         *         empty string, or if if the <CODE>qualifiedName</CODE> has a 
prefix 
         *         different from "xml" and "xmlns" and the 
<CODE>namespaceURI</CODE> 
         *         is <CODE>null</CODE> or an empty string.
         */
        virtual void
        setAttributeNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   qualifiedName,
                        const XalanDOMString&   value);
  
        /**
         * Removes an attribute by local name and namespace URI. If the
         * removed attribute has a default value it is immediately replaced.
         * The replacing attribute has the same namespace URI and local name, 
as well as 
         * the original prefix.<BR>HTML-only DOM implementations do not need to 
         * implement this method.
         *
         * @param namespaceURI The <em>namespace URI</em> of
         *    the attribute to remove.
         * @param localName The <em>local name</em> of the
         *    attribute to remove.
         * @exception DOMException
         *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         */
        virtual void
        removeAttributeNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName);
  
        /**
         * Retrieves an <code>DOM_Attr</code> node by local name and namespace 
URI.
         *
         * @param namespaceURI The <em>namespace URI</em> of
         *    the attribute to retrieve.
         * @param localName The <em>local name</em> of the
         *    attribute to retrieve.
         * @return The <code>DOM_Attr</code> node with the specified attribute 
local
         *    name and namespace URI or <code>null</code> if there is no such 
attribute.
         */
        virtual XalanAttr*
        getAttributeNodeNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName) const;
  
        /**
          * Adds a new attribute. 
          * 
          * If an attribute with that local name and namespace URI is already 
present 
          * in the element, it is replaced by the new one.
          * @param newAttr The <code>DOM_Attr</code> node to add to the 
attribute list.
          * @return If the <code>newAttr</code> attribute replaces an existing
          *    attribute with the same <em>local name</em> and <em>namespace 
URI</em>,
          *    the replaced <code>DOM_Attr</code> node is
          *    returned, otherwise <code>null</code> is returned.
          * @exception DOMException
          *   WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created 
from a 
          *   different document than the one that created the element.
          *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
          *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is 
already an 
          *   attribute of another <code>DOM_Element</code> object. The DOM 
user must 
          *   explicitly clone <code>DOM_Attr</code> nodes to re-use them in 
other 
          *   elements.
          */
        virtual XalanAttr*
        setAttributeNodeNS(XalanAttr*   newAttr);
  
        /**
         * Returns a <code>DOM_NodeList</code> of all the 
<code>DOM_Element</code>s
         * with a given local name and namespace URI in the order in which they
         * would be encountered in a preorder traversal of the
         * <code>DOM_Document</code> tree, starting from this node.  Caller is
         * responsible for deleting the XalanNodeList instance.
         *
         * @param namespaceURI The <em>namespace URI</em> of
         *    the elements to match on. The special value "*" matches all
         *    namespaces.
         * @param localName The <em>local name</em> of the
         *    elements to match on. The special value "*" matches all local 
names.
         * @return A new <code>DOM_NodeList</code> object containing all the 
matched
         *    <code>Element</code>s.
         */
        virtual XalanNodeList*
        getElementsByTagNameNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName) const;
  
    //@}
  
  
        // public interfaces not inherited from XalanElement...
  
        XalanSourceTreeDocument*
        getDocument() const
        {
                return m_ownerDocument;
        }
  
        XalanSourceTreeElement*
        getParentElement() const
        {
                return m_parentElement;
        }
  
        void
        setParentElement(XalanSourceTreeElement*        theParent)
        {
                m_parentElement = theParent;
        }
  
        void
        setPreviousSibling(XalanSourceTreeComment*      thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeCDATASection*         
thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeElement*      thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeProcessingInstruction*        
thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeText*         thePreviousSibling);
  
        void
        appendSiblingNode(XalanSourceTreeComment*       theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeCDATASection*  theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeElement*       theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeProcessingInstruction*         
theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeText*  theSibling);
  
        void
        appendChildNode(XalanSourceTreeComment*         theChild);
  
        void
        appendChildNode(XalanSourceTreeCDATASection*    theChild);
  
        void
        appendChildNode(XalanSourceTreeElement*         theChild);
  
        void
        appendChildNode(XalanSourceTreeProcessingInstruction*   theChild);
  
        void
        appendChildNode(XalanSourceTreeText*    theChild);
  
        void
        setIndex(unsigned int   theIndex)
        {
                m_index = theIndex;
        }
  
        unsigned int
        getAttributeCount() const
        {
                return m_attributeCount;
        }
  
        XalanSourceTreeAttr*
        item(unsigned int       index) const
        {
                return index < m_attributeCount ? m_attributes[index] : 0;
        }
  
  protected:
  
        XalanSourceTreeElement(
                        const XalanSourceTreeElement&   theSource,
                        bool                                                    
deep = false);
  
  private:
  
        // Not implemented...
        XalanSourceTreeElement&
        operator=(const XalanSourceTreeElement&         theSource);
  
        bool
        operator==(const XalanSourceTreeElement&        theRHS) const;
  
  
        // Data members...
        const XalanDOMString&                   m_tagName;
  
        XalanSourceTreeDocument*                m_ownerDocument;
  
        XalanSourceTreeElement*                 m_parentElement;
  
        XalanNode*                                              
m_previousSibling;
  
        XalanNode*                                              m_nextSibling;
  
        XalanNode*                                              m_firstChild;
  
        unsigned int                                    m_index;
  
        XalanSourceTreeAttr* const *    m_attributes;
  
        const unsigned int                              m_attributeCount;
  
        XalanNodeListSurrogate                  m_childList;
  
        XalanSourceTreeNamedNodeMap             m_attributeNamedNodeMap;
  };
  
  
  
  #endif        // !defined(XALANSOURCETREEELEMENT_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementAllocator.cpp
  
  Index: XalanSourceTreeElementAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanSourceTreeElementAllocator.hpp"
  
  
  
  XalanSourceTreeElementAllocator::XalanSourceTreeElementAllocator(size_type    
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanSourceTreeElementAllocator::~XalanSourceTreeElementAllocator()
  {
  }
  
  
  
  XalanSourceTreeElementAllocator::ObjectType*
  XalanSourceTreeElementAllocator::create(
                        const XalanDOMString&           theTagName,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeAttr**           theAttributes,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex)
  {
        ObjectType* const       theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        new(theBlock) ObjectType(
                                                theTagName,
                                                theOwnerDocument,
                                                theAttributes,
                                                theAttributeCount,
                                                theParentElement,
                                                thePreviousSibling,
                                                theNextSibling,
                                                theIndex);
  
        m_allocator.commitAllocation(theBlock);
  
        return theBlock;
  }
  
  
  
  void 
  XalanSourceTreeElementAllocator::reset()
  {
        m_allocator.reset();
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementAllocator.hpp
  
  Index: XalanSourceTreeElementAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREEELEMENTALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANSOURCETREEELEMENTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeElement.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementAllocator
  {
  public:
  
        typedef XalanSourceTreeElement                                  
ObjectType;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<ObjectType>                                  
ArenaBlockType;
  
        typedef ArenaAllocator<ObjectType,
                                                   ArenaBlockType>              
        ArenaAllocatorType;
  #else
        typedef ArenaAllocator<ObjectType>                              
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type                   size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanSourceTreeElementAllocator(size_type       theBlockCount);
  
        ~XalanSourceTreeElementAllocator();
  
        /**
         * Create an instance.
         * 
         * @param theTagName The tag name of the element
         * @param theOwnerDocument The document that owns the instance
         * @param theAttributes An array of pointers to the attribute instances 
for the element
         * @param theAttributeCount The number of attributes.
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The previous sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        ObjectType*
        create(
                        const XalanDOMString&           theTagName,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeAttr**           theAttributes,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        /**
         * Delete all objects from allocator.    
         */     
        void
        reset();
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanSourceTreeElementAllocator(const XalanSourceTreeElementAllocator&);
  
        XalanSourceTreeElementAllocator&
        operator=(const XalanSourceTreeElementAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANSOURCETREEELEMENTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNS.cpp
  
  Index: XalanSourceTreeElementNS.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeElementNS.hpp"
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  XalanSourceTreeElementNS::XalanSourceTreeElementNS(
                        const XalanDOMString&           theTagName,
                        const XalanDOMString&           theLocalName,
                        const XalanDOMString&           theNamespaceURI,
                        const XalanDOMString&           thePrefix,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeAttr**           theAttributes,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex) :
        XalanSourceTreeElement(
                theTagName,
                theOwnerDocument,
                theAttributes,
                theAttributeCount,
                theParentElement,
                thePreviousSibling,
                theNextSibling,
                theIndex),
        m_localName(theLocalName),
        m_prefix(thePrefix),
        m_namespaceURI(theNamespaceURI)
  {
  }
  
  
  
  XalanSourceTreeElementNS::~XalanSourceTreeElementNS()
  {
  }
  
  
  
  XalanSourceTreeElementNS::XalanSourceTreeElementNS(
                        const XalanSourceTreeElementNS&         theSource,
                        bool                                                    
        deep) :
        XalanSourceTreeElement(theSource, deep),
        m_localName(theSource.m_localName),
        m_prefix(theSource.m_prefix),
        m_namespaceURI(theSource.m_namespaceURI)
  {
  }
  
  
  
  XalanSourceTreeElementNS::XalanSourceTreeElementNS(
                        const XalanSourceTreeElement&   theSource,
                        bool                                                    
deep) :
        XalanSourceTreeElement(theSource, deep),
        m_localName(theSource.getLocalName()),
        m_prefix(theSource.getPrefix()),
        m_namespaceURI(theSource.getNamespaceURI())
  {
  }
  
  
  
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
  XalanNode*
  #else
  XalanSourceTreeElementNS*
  #endif
  XalanSourceTreeElementNS::cloneNode(bool      deep) const
  {
        return new XalanSourceTreeElementNS(*this, deep);
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElementNS::getNamespaceURI() const
  {
        return m_namespaceURI;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElementNS::getPrefix() const
  {
        return m_prefix;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeElementNS::getLocalName() const
  {
        return m_localName;
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNS.hpp
  
  Index: XalanSourceTreeElementNS.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREEELEMENTNS_HEADER_GUARD_1357924680)
  #define XALANSOURCETREEELEMENTNS_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeElement.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementNS : public 
XalanSourceTreeElement
  {
  public:
  
        /**
         * Constructor.
         *
         * @param theTagName The tag name of the element
         * @param theLocalName The local name of the attribute
         * @param theNamespaceURI The namespace URI of the attribute
         * @param thePrefix The namespace prefix of the attribute
         * @param theOwnerDocument The document that owns the instance
         * @param theAttributes An array of pointers to the attribute instances 
for the element
         * @param theAttributeCount The number of attributes.
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The previous sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         */
        XalanSourceTreeElementNS(
                        const XalanDOMString&           theTagName,
                        const XalanDOMString&           theLocalName,
                        const XalanDOMString&           theNamespaceURI,
                        const XalanDOMString&           thePrefix,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeAttr**           theAttributes,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        virtual
        ~XalanSourceTreeElementNS();
  
  
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
        virtual XalanNode*
  #else
        virtual XalanSourceTreeElementNS*
  #endif
        cloneNode(bool deep) const;
  
        virtual const XalanDOMString&
        getNamespaceURI() const;
  
        virtual const XalanDOMString&
        getPrefix() const;
  
        virtual const XalanDOMString&
        getLocalName() const;
  
  protected:
  
        XalanSourceTreeElementNS(
                        const XalanSourceTreeElementNS&         theSource,
                        bool                                                    
        deep);
  
        XalanSourceTreeElementNS(
                        const XalanSourceTreeElement&   theSource,
                        bool                                                    
deep);
  private:
  
        // Not implemented...
        XalanSourceTreeElementNS&
        operator=(const XalanSourceTreeElementNS&       theSource);
  
        bool
        operator==(const XalanSourceTreeElementNS&      theRHS) const;
  
  
        // Data members...
        const XalanDOMString&   m_localName;
  
        const XalanDOMString&   m_prefix;
  
        const XalanDOMString&   m_namespaceURI;
  };
  
  
  
  #endif        // !defined(XALANSOURCETREEELEMENTNS_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNSAllocator.cpp
  
  Index: XalanSourceTreeElementNSAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanSourceTreeElementNSAllocator.hpp"
  
  
  
  
XalanSourceTreeElementNSAllocator::XalanSourceTreeElementNSAllocator(size_type  
              theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanSourceTreeElementNSAllocator::~XalanSourceTreeElementNSAllocator()
  {
  }
  
  
  
  XalanSourceTreeElementNSAllocator::ObjectType*
  XalanSourceTreeElementNSAllocator::create(
                        const XalanDOMString&           theTagName,
                        const XalanDOMString&           theLocalName,
                        const XalanDOMString&           theNamespaceURI,
                        const XalanDOMString&           thePrefix,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeAttr**           theAttributes,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex)
  {
        ObjectType* const       theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        new(theBlock) ObjectType(
                                                theTagName,
                                                theLocalName,
                                                theNamespaceURI,
                                                thePrefix,
                                                theOwnerDocument,
                                                theAttributes,
                                                theAttributeCount,
                                                theParentElement,
                                                thePreviousSibling,
                                                theNextSibling,
                                                theIndex);
  
        m_allocator.commitAllocation(theBlock);
  
        return theBlock;
  }
  
  
  
  void 
  XalanSourceTreeElementNSAllocator::reset()
  {
        m_allocator.reset();
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeElementNSAllocator.hpp
  
  Index: XalanSourceTreeElementNSAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREEELEMENTNSALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANSOURCETREEELEMENTNSALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeElementNS.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeElementNSAllocator
  {
  public:
  
        typedef XalanSourceTreeElementNS                                
ObjectType;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<ObjectType>                                  
ArenaBlockType;
  
        typedef ArenaAllocator<ObjectType,
                                                   ArenaBlockType>              
        ArenaAllocatorType;
  #else
        typedef ArenaAllocator<ObjectType>                              
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type                   size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanSourceTreeElementNSAllocator(size_type     theBlockCount);
  
        ~XalanSourceTreeElementNSAllocator();
  
        /**
         * Create an instance.
         * 
         * @param theTagName The tag name of the element
         * @param theLocalName The local name of the attribute
         * @param theNamespaceURI The namespace URI of the attribute
         * @param thePrefix The namespace prefix of the attribute
         * @param theOwnerDocument The document that owns the instance
         * @param theAttributes An array of pointers to the attribute instances 
for the element
         * @param theAttributeCount The number of attributes.
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The previous sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        ObjectType*
        create(
                        const XalanDOMString&           theTagName,
                        const XalanDOMString&           theLocalName,
                        const XalanDOMString&           theNamespaceURI,
                        const XalanDOMString&           thePrefix,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeAttr**           theAttributes,
                        unsigned int                            
theAttributeCount,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        /**
         * Delete all objects from allocator.    
         */     
        void
        reset();
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanSourceTreeElementNSAllocator(const 
XalanSourceTreeElementNSAllocator&);
  
        XalanSourceTreeElementNSAllocator&
        operator=(const XalanSourceTreeElementNSAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANSOURCETREEELEMENTNSALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  xml-xalan/c/src/XalanSourceTree/XalanSourceTreeHelper.cpp
  
  Index: XalanSourceTreeHelper.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "XalanSourceTreeHelper.hpp"
  
  
  
  #include <cassert>
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  #include "XalanSourceTreeComment.hpp"
  #include "XalanSourceTreeCDATASection.hpp"
  #include "XalanSourceTreeDocument.hpp"
  #include "XalanSourceTreeElement.hpp"
  #include "XalanSourceTreeProcessingInstruction.hpp"
  #include "XalanSourceTreeText.hpp"
  
  
  
  template<class TargetType>
  inline TargetType*
  castTo(XalanNode*     theNode)
  {
  #if defined(XALAN_OLD_STYLE_CASTS)
        return (TargetType*)theNode;
  #else
        return static_cast<TargetType*>(theNode);
  #endif
  }
  
  
  
  template<class NodeType>
  inline void
  doAppendSibling(
                        XalanNode*      theNode,
                        NodeType*       theNewSibling)
  {
        assert(theNode != 0);
        assert(theNewSibling != 0);
  
        XalanNode* const        theLastSibling = 
XalanSourceTreeHelper::getLastSibling(theNode);
  
        switch(theLastSibling->getNodeType())
        {
        case XalanNode::CDATA_SECTION_NODE:
                
castTo<XalanSourceTreeCDATASection>(theLastSibling)->appendSiblingNode(theNewSibling);
                break;
  
        case XalanNode::COMMENT_NODE:
                
castTo<XalanSourceTreeComment>(theLastSibling)->appendSiblingNode(theNewSibling);
                break;
  
        case XalanNode::ELEMENT_NODE:
                
castTo<XalanSourceTreeElement>(theLastSibling)->appendSiblingNode(theNewSibling);
                break;
  
        case XalanNode::PROCESSING_INSTRUCTION_NODE:
                
castTo<XalanSourceTreeProcessingInstruction>(theLastSibling)->appendSiblingNode(theNewSibling);
                break;
  
        case XalanNode::TEXT_NODE:
                
castTo<XalanSourceTreeText>(theLastSibling)->appendSiblingNode(theNewSibling);
                break;
  
        default:
                throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
                break;
        }
  }
  
  
  
  template <class NodeType1, class NodeType2>
  inline void
  append(
                        NodeType1*              thePreviousSibling,
                        XalanNode*&             theNextSiblingSlot,
                        NodeType2*              theNewSibling)
  {
        if (theNextSiblingSlot == 0)
        {
                theNextSiblingSlot = theNewSibling;
  
                if (thePreviousSibling != 0)
                {
                        theNewSibling->setPreviousSibling(thePreviousSibling);
                }
        }
        else
        {
                doAppendSibling(theNextSiblingSlot, theNewSibling);
        }
  }
  
  
  
  template <class NodeType>
  inline void
  append(
                        XalanNode*&             theNextSiblingSlot,
                        NodeType*               theNewSibling)
  {
        if (theNextSiblingSlot == 0)
        {
                theNextSiblingSlot = theNewSibling;
        }
        else
        {
                doAppendSibling(theNextSiblingSlot, theNewSibling);
        }
  }
  
  
  
  template <class NodeType>
  inline void
  doAppendSibling(
                        NodeType*               thePreviousSibling,
                        XalanNode*&             theNextSiblingSlot,
                        XalanNode*              theNewSibling)
  {
        assert(theNewSibling != 0);
        assert(theNextSiblingSlot == 0 || theNextSiblingSlot->getParentNode() 
== theNewSibling->getParentNode());
  
        switch(theNewSibling->getNodeType())
        {
        case XalanNode::CDATA_SECTION_NODE:
                append(thePreviousSibling, theNextSiblingSlot, 
castTo<XalanSourceTreeCDATASection>(theNewSibling));
                break;
  
        case XalanNode::COMMENT_NODE:
                append(thePreviousSibling, theNextSiblingSlot, 
castTo<XalanSourceTreeComment>(theNewSibling));
                break;
  
        case XalanNode::ELEMENT_NODE:
                append(thePreviousSibling, theNextSiblingSlot, 
castTo<XalanSourceTreeElement>(theNewSibling));
                break;
  
        case XalanNode::PROCESSING_INSTRUCTION_NODE:
                append(thePreviousSibling, theNextSiblingSlot, 
castTo<XalanSourceTreeProcessingInstruction>(theNewSibling));
                break;
  
        case XalanNode::TEXT_NODE:
                append(thePreviousSibling, theNextSiblingSlot, 
castTo<XalanSourceTreeText>(theNewSibling));
                break;
  
        default:
                throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
                break;
        }
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSibling(
                        XalanSourceTreeDocument*        theDocument,
                        XalanNode*&                                     
theNextSiblingSlot,
                        XalanNode*                                      
theNewSibling)
  {
        if (theNewSibling->getOwnerDocument() != theDocument)
        {
                throw XalanDOMException(XalanDOMException::WRONG_DOCUMENT_ERR);
        }
        else
        {
                switch(theNewSibling->getNodeType())
                {
                case XalanNode::ELEMENT_NODE:
                        append(theNextSiblingSlot, 
castTo<XalanSourceTreeElement>(theNewSibling));
                        break;
  
                case XalanNode::PROCESSING_INSTRUCTION_NODE:
                        append(theNextSiblingSlot, 
castTo<XalanSourceTreeProcessingInstruction>(theNewSibling));
                        break;
  
                default:
                        throw 
XalanDOMException(XalanDOMException::HIERARCHY_REQUEST_ERR);
                        break;
                }
        }
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSibling(
                        XalanSourceTreeCDATASection*    theNode,
                        XalanNode*&                                             
theNextSiblingSlot,
                        XalanNode*                                              
theNewSibling)
  {
        doAppendSibling(theNode, theNextSiblingSlot, theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSibling(
                        XalanSourceTreeComment*         theNode,
                        XalanNode*&                                     
theNextSiblingSlot,
                        XalanNode*                                      
theNewSibling)
  {
        doAppendSibling(theNode, theNextSiblingSlot, theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSibling(
                        XalanSourceTreeElement*         theNode,
                        XalanNode*&                                     
theNextSiblingSlot,
                        XalanNode*                                      
theNewSibling)
  {
        doAppendSibling(theNode, theNextSiblingSlot, theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSibling(
                        XalanSourceTreeProcessingInstruction*   theNode,
                        XalanNode*&                                             
                theNextSiblingSlot,
                        XalanNode*                                              
                theNewSibling)
  {
        doAppendSibling(theNode, theNextSiblingSlot, theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSibling(
                        XalanSourceTreeText*    theNode,
                        XalanNode*&                             
theNextSiblingSlot,
                        XalanNode*                              theNewSibling)
  {
        doAppendSibling(theNode, theNextSiblingSlot, theNewSibling);
  }
  
  
  
  template <class NodeType>
  void
  doAppendSiblingToChild(
                        XalanSourceTreeElement*         theOwnerElement,
                        XalanNode*&                                     
theFirstChildSlot,
                        NodeType*                                       
theNewSibling)
  {
        assert(theOwnerElement != 0);
        assert(theNewSibling != 0);
  
        if (theNewSibling->getParentElement() != theOwnerElement)
        {
                theNewSibling->setParentElement(theOwnerElement);
        }
  
        append(theFirstChildSlot, theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSiblingToChild(
                        XalanSourceTreeElement*                 theOwnerElement,
                        XalanNode*&                                             
theFirstChildSlot,
                        XalanSourceTreeCDATASection*    theNewSibling)
  {
        doAppendSiblingToChild(theOwnerElement, theFirstChildSlot, 
theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSiblingToChild(
                        XalanSourceTreeElement*         theOwnerElement,
                        XalanNode*&                                     
theFirstChildSlot,
                        XalanSourceTreeComment*         theNewSibling)
  {
        doAppendSiblingToChild(theOwnerElement, theFirstChildSlot, 
theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSiblingToChild(
                        XalanSourceTreeElement*         theOwnerElement,
                        XalanNode*&                                     
theFirstChildSlot,
                        XalanSourceTreeElement*         theNewSibling)
  {
        doAppendSiblingToChild(theOwnerElement, theFirstChildSlot, 
theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSiblingToChild(
                        XalanSourceTreeElement*                                 
theOwnerElement,
                        XalanNode*&                                             
                theFirstChildSlot,
                        XalanSourceTreeProcessingInstruction*   theNewSibling)
  {
        doAppendSiblingToChild(theOwnerElement, theFirstChildSlot, 
theNewSibling);
  }
  
  
  
  void
  XalanSourceTreeHelper::appendSiblingToChild(
                        XalanSourceTreeElement*         theOwnerElement,
                        XalanNode*&                                     
theFirstChildSlot,
                        XalanSourceTreeText*            theNewSibling)
  {
        doAppendSiblingToChild(theOwnerElement, theFirstChildSlot, 
theNewSibling);
  }
  
  
  
  
  XalanNode*
  XalanSourceTreeHelper::getLastSibling(XalanNode*      theNode)
  {
        if (theNode == 0)
        {
                return 0;
        }
        else
        {
                XalanNode*      theNextSibling = theNode->getNextSibling();
  
                while(theNextSibling != 0)
                {
                        theNode = theNextSibling;
  
                        theNextSibling = theNode->getNextSibling();
                }
  
                return theNode;
        }
  }
  
  
  
  1.1                  xml-xalan/c/src/XalanSourceTree/XalanSourceTreeHelper.hpp
  
  Index: XalanSourceTreeHelper.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREEHELPER_HEADER_GUARD_1357924680)
  #define XALANSOURCETREEHELPER_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanDOM/XalanDOMString.hpp>
  
  
  
  class XalanNode;
  class XalanSourceTreeCDATASection;
  class XalanSourceTreeComment;
  class XalanSourceTreeDocument;
  class XalanSourceTreeElement;
  class XalanSourceTreeProcessingInstruction;
  class XalanSourceTreeText;
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeHelper
  {
  public:
  
        friend class XalanSourceTreeCDATASection;
        friend class XalanSourceTreeComment;
        friend class XalanSourceTreeDocument;
        friend class XalanSourceTreeElement;
        friend class XalanSourceTreeProcessingInstruction;
        friend class XalanSourceTreeText;
  
        static XalanNode*
        getLastSibling(XalanNode*       theNode);
  
  private:
  
        static void
        appendSibling(
                        XalanSourceTreeDocument*        theDocument,
                        XalanNode*&                                     
theNextSiblingSlot,
                        XalanNode*                                      
theNewSibling);
  
        static void
        appendSibling(
                        XalanSourceTreeCDATASection*    theNode,
                        XalanNode*&                                             
theNextSiblingSlot,
                        XalanNode*                                              
theNewSibling);
  
        static void
        appendSibling(
                        XalanSourceTreeComment*         theNode,
                        XalanNode*&                                     
theNextSiblingSlot,
                        XalanNode*                                      
theNewSibling);
  
        static void
        appendSibling(
                        XalanSourceTreeElement*         theNode,
                        XalanNode*&                                     
theNextSiblingSlot,
                        XalanNode*                                      
theNewSibling);
  
        static void
        appendSibling(
                        XalanSourceTreeProcessingInstruction*   theNode,
                        XalanNode*&                                             
                theNextSiblingSlot,
                        XalanNode*                                              
                theNewSibling);
  
        static void
        appendSibling(
                        XalanSourceTreeText*    theNode,
                        XalanNode*&                             
theNextSiblingSlot,
                        XalanNode*                              theNewSibling);
  
        static void
        appendSiblingToChild(
                        XalanSourceTreeElement*                 theOwnerElement,
                        XalanNode*&                                             
theChildSlot,
                        XalanSourceTreeCDATASection*    theNewSibling);
  
        static void
        appendSiblingToChild(
                        XalanSourceTreeElement*         theOwnerElement,
                        XalanNode*&                                     
theChildSlot,
                        XalanSourceTreeComment*         theNewSibling);
  
        static void
        appendSiblingToChild(
                        XalanSourceTreeElement*         theOwnerElement,
                        XalanNode*&                                     
theChildSlot,
                        XalanSourceTreeElement*         theNewSibling);
  
        static void
        appendSiblingToChild(
                        XalanSourceTreeElement*                                 
theOwnerElement,
                        XalanNode*&                                             
                theChildSlot,
                        XalanSourceTreeProcessingInstruction*   theNewSibling);
  
        static void
        appendSiblingToChild(
                        XalanSourceTreeElement*         theOwnerElement,
                        XalanNode*&                                     
theChildSlot,
                        XalanSourceTreeText*            theNewSibling);
  
  private:
  
        // Not implemented...
        XalanSourceTreeHelper();
  
        XalanSourceTreeHelper(const XalanSourceTreeHelper&);
  };
  
  
  
  #endif        // !defined(XALANSOURCETREEHELPER_HEADER_GUARD_1357924680)
  
  
  
  1.1                  xml-xalan/c/src/XalanSourceTree/XalanSourceTreeInit.cpp
  
  Index: XalanSourceTreeInit.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "XalanSourceTreeInit.hpp"
  
  
  
  #include "XalanSourceTreeDocument.hpp"
  #include "XalanSourceTreeText.hpp"
  
  
  
  unsigned long XalanSourceTreeInit::s_initCounter = 0;
  
  
  
  XalanSourceTreeInit::XalanSourceTreeInit() :
        m_platformSupportInit(),
        m_domSupportInit(),
        m_xmlSupportInit()
  {
        ++s_initCounter;
  
        if (s_initCounter == 1)
        {
                initialize();
        }
  }
  
  
  
  XalanSourceTreeInit::~XalanSourceTreeInit()
  {
        --s_initCounter;
  
        if (s_initCounter == 0)
        {
                terminate();
        }
  }
  
  
  
  void
  XalanSourceTreeInit::initialize()
  {
        XalanSourceTreeDocument::initialize();
  
        XalanSourceTreeText::initialize();
  }
  
  
  
  void
  XalanSourceTreeInit::terminate()
  {
        XalanSourceTreeText::terminate();
  
        XalanSourceTreeDocument::terminate();
  }
  
  
  
  1.1                  xml-xalan/c/src/XalanSourceTree/XalanSourceTreeInit.hpp
  
  Index: XalanSourceTreeInit.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREEINIT_INCLUDE_GUARD_1357924680)
  #define XALANSOURCETREEINIT_INCLUDE_GUARD_1357924680
  
  
  
  // Base include file.  Must be first.
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/PlatformSupportInit.hpp>
  
  
  
  #include <DOMSupport/DOMSupportInit.hpp>
  
  
  
  #include <XMLSupport/XMLSupportInit.hpp>
  
  
  
  #include <XPath/XPathInit.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeInit
  {
  public:
  
        explicit
        XalanSourceTreeInit();
  
        ~XalanSourceTreeInit();
  
  private:
  
        // Not implemented...
        XalanSourceTreeInit(const XalanSourceTreeInit&);
  
        XalanSourceTreeInit&
        operator=(const XalanSourceTreeInit&);
  
        
        static void
        initialize();
  
        static void
        terminate();
  
        const PlatformSupportInit       m_platformSupportInit;
  
        const DOMSupportInit            m_domSupportInit;
  
        const XMLSupportInit            m_xmlSupportInit;
  
        static unsigned long    s_initCounter;
  };
  
  
  
  #endif        // !defined(XALANSOURCETREEINIT_INCLUDE_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeNamedNodeMap.cpp
  
  Index: XalanSourceTreeNamedNodeMap.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeNamedNodeMap.hpp"
  
  
  
  #include <algorithm>
  #include <cassert>
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  #include <PlatformSupport/DOMStringHelper.hpp>
  
  
  
  #include "XalanSourceTreeAttr.hpp"
  #include "XalanSourceTreeElement.hpp"
  
  
  
  
  XalanSourceTreeNamedNodeMap::XalanSourceTreeNamedNodeMap(const 
XalanSourceTreeElement*        theElement) :
        m_element(theElement)
  {
        assert(m_element != 0);
  }
  
  
  
  XalanSourceTreeNamedNodeMap::~XalanSourceTreeNamedNodeMap()
  {
  }
  
  
  
  XalanSourceTreeNamedNodeMap::XalanSourceTreeNamedNodeMap(const 
XalanSourceTreeNamedNodeMap&           theSource) :
        m_element(theSource.m_element)
  {
  }
  
  
  
  XalanSourceTreeNamedNodeMap&
  XalanSourceTreeNamedNodeMap::operator=(const XalanSourceTreeNamedNodeMap&     
theSource)
  {
        if (&theSource != this)
        {
                m_element = theSource.m_element;
        }
  
        return *this;
  }
  
  
  
  bool
  XalanSourceTreeNamedNodeMap::operator==(const XalanSourceTreeNamedNodeMap&    
/* theRHS */) const
  {
        return false;
  }
  
  
  
  XalanNode*
  XalanSourceTreeNamedNodeMap::setNamedItem(XalanNode*  /* arg */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeNamedNodeMap::item(unsigned int        index) const
  {
        return m_element->item(index);
  }
  
  
  
  XalanNode*
  XalanSourceTreeNamedNodeMap::getNamedItem(const XalanDOMString&       name) 
const
  {
        assert(m_element != 0);
  
        return m_element->getAttributeNode(name);
  }
  
  
  
  unsigned int
  XalanSourceTreeNamedNodeMap::getLength() const
  {
        assert(m_element != 0);
  
        return m_element->getAttributeCount();
  }
  
  
  
  XalanNode*
  XalanSourceTreeNamedNodeMap::removeNamedItem(const XalanDOMString&    /* name 
*/)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeNamedNodeMap::getNamedItemNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName) const
  {
        assert(m_element != 0);
  
        return m_element->getAttributeNodeNS(namespaceURI, localName);
  }
  
  
  
  XalanNode*
  XalanSourceTreeNamedNodeMap::setNamedItemNS(XalanNode*        /* arg */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeNamedNodeMap::removeNamedItemNS(
                        const XalanDOMString&   /* namespaceURI */,
                        const XalanDOMString&   /* localName */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeNamedNodeMap.hpp
  
  Index: XalanSourceTreeNamedNodeMap.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREENAMEDNODEMAP_HEADER_GUARD_1357924680)
  #define XALANSOURCETREENAMEDNODEMAP_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanDOM/XalanNamedNodeMap.hpp>
  
  
  
  class XalanSourceTreeElement;
  
  
  
  /*
   * <meta name="usage" content="experimental"/>
   *
   * Base class for the source tree NamedNodeMap interface.
   *
   * This class is experimental and subject to change!!
   */
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeNamedNodeMap : public 
XalanNamedNodeMap
  {
  public:
  
        XalanSourceTreeNamedNodeMap(const XalanSourceTreeElement*       
theElement);
  
        XalanSourceTreeNamedNodeMap(const XalanSourceTreeNamedNodeMap&  
theSource);
  
        virtual
        ~XalanSourceTreeNamedNodeMap();
  
        XalanSourceTreeNamedNodeMap&
        operator=(const XalanSourceTreeNamedNodeMap&            theSource);
  
        bool
        operator==(const XalanSourceTreeNamedNodeMap&   theRHS) const;
  
  
        /** @name Set functions. */
        //@{
  
        /**
         * Adds a node using its <code>nodeName</code> attribute. 
         *
         * <br>As the <code>nodeName</code> attribute is used to derive the 
name 
         * which the node must be stored under, multiple nodes of certain types 
         * (those that have a "special" string value) cannot be stored as the 
names 
         * would clash. This is seen as preferable to allowing nodes to be 
aliased.
         * @param arg A node to store in a named node map. The node will later 
be 
         *       accessible using the value of the <code>nodeName</code> 
attribute of 
         *       the node. If a node with that name is already present in the 
map, it 
         *       is replaced by the new one.
         * @return If the new <code>Node</code> replaces an existing node the
         *       replaced <code>Node</code> is returned, 
         *       otherwise <code>null</code> is returned.
         * @exception DOMException
         *       WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created 
from a 
         *       different document than the one that created the 
         *       <code>NamedNodeMap</code>.
         *       <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this 
         *       <code>NamedNodeMap</code> is readonly.
         *       <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an 
         *       <code>Attr</code> that is already an attribute of another 
         *       <code>Element</code> object. The DOM user must explicitly 
clone 
         *       <code>Attr</code> nodes to re-use them in other elements.
         */
        virtual XalanNode*
        setNamedItem(XalanNode*         arg);
  
        /**
         * Returns the <code>index</code>th item in the map. 
         *
         * If <code>index</code> 
         * is greater than or equal to the number of nodes in the map, this 
returns 
         * <code>null</code>.
         * @param index Index into the map.
         * @return The node at the <code>index</code>th position in the 
         *       <code>NamedNodeMap</code>, or <code>null</code> if that is not 
a valid 
         *       index.
         */
        virtual XalanNode*
        item(unsigned int       index) const;
  
        //@}
        /** @name Get functions. */
        //@{
  
        /**
         * Retrieves a node specified by name.
         *
         * @param name The <code>nodeName</code> of a node to retrieve.
         * @return A <code>Node</code> (of any type) with the specified 
<code>nodeName</code>, or 
         *       <code>null</code> if it does not identify any node in 
         *       the map. 
         */
        virtual XalanNode*
        getNamedItem(const XalanDOMString&      name) const;
  
        /**
         * The number of nodes in the map. 
         *
         * The range of valid child node indices is 
         * 0 to <code>length-1</code> inclusive. 
         */
        virtual unsigned int
        getLength() const;
  
        //@}
        /** @name Functions to change the node collection. */
        //@{
  
        /**
        * Removes a node specified by name.
        *
        * If the removed node is an 
        * <code>Attr</code> with a default value it is immediately replaced.
        * @param name The <code>nodeName</code> of a node to remove.
        * @return The node removed from the map or <code>null</code> if no node 
        *       with such a name exists.
        * @exception DOMException
        *       NOT_FOUND_ERR: Raised if there is no node named 
<code>name</code> in 
        *       the map.
        * <br>
        *       NO_MODIFICATION_ALLOWED_ERR: Raised if this 
<code>NamedNodeMap</code>
        *       is readonly.
        */
        virtual XalanNode*
        removeNamedItem(const XalanDOMString&   name);
  
        //@}
        /** @name Functions introduced in DOM Level 2. */
        //@{
  
        /**
         * Retrieves a node specified by local name and namespace URI.
         *
         * @param namespaceURI The <em>namespace URI</em> of
         *        the node to retrieve.
         * @param localName The <em>local name</em> of the node to retrieve.
         * @return A <code>Node</code> (of any type) with the specified
         *        local name and namespace URI, or <code>null</code> if they do 
not
         *        identify any node in the map.
         */
        virtual XalanNode*
        getNamedItemNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName) const;
  
        /**
         * Adds a node using its <CODE>namespaceURI</CODE> and 
<CODE>localName</CODE>.
         * @param arg A node to store in a named node map. The node will later 
be 
         *               accessible using the value of the 
<CODE>namespaceURI</CODE> and 
         *               <CODE>localName</CODE> attribute of the node. If a 
node with those 
         *               namespace URI and local name is already present in the 
map, it is 
         *               replaced by the new one.
         * @return If the new <code>Node</code> replaces an existing node the
         *       replaced <code>Node</code> is returned, 
         *       otherwise <code>null</code> is returned.
         * @exception DOMException
         *       WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created 
from a 
         *       different document than the one that created the 
         *       <code>NamedNodeMap</code>.
         *       <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this 
         *       <code>NamedNodeMap</code> is readonly.
         *       <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an 
         *       <code>Attr</code> that is already an attribute of another 
         *       <code>Element</code> object. The DOM user must explicitly 
clone 
         *       <code>Attr</code> nodes to re-use them in other elements.
         */
        virtual XalanNode*
        setNamedItemNS(XalanNode*       arg);
  
        /**
         * Removes a node specified by local name and namespace URI.
         *
         * @param namespaceURI The <em>namespace URI</em> of
         *        the node to remove.
         * @param localName The <em>local name</em> of the
         *        node to remove. When this <code>NamedNodeMap</code> contains 
the
         *        attributes attached to an element, as returned by the 
attributes
         *        attribute of the <code>Node</code> interface, if the removed
         *        attribute is known to have a default value, an attribute
         *        immediately appears containing the default value
         *        as well as the corresponding namespace URI, local name, and 
prefix.
         * @return The node removed from the map if a node with such a local 
name
         *        and namespace URI exists.
         * @exception DOMException
         *       NOT_FOUND_ERR: Raised if there is no node named 
<code>name</code> in 
         *       the map.
         * <br>
         *       NO_MODIFICATION_ALLOWED_ERR: Raised if this 
<code>NamedNodeMap</code>
         *       is readonly.
         */
        virtual XalanNode*
        removeNamedItemNS(
                        const XalanDOMString&   namespaceURI,
                        const XalanDOMString&   localName);
  
        //@}
  
  private:
  
        const XalanSourceTreeElement*   m_element;
  };
  
  
  
  #endif        // !defined(XALANSOURCETREENAMEDNODEMAP_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeParserLiaison.cpp
  
  Index: XalanSourceTreeParserLiaison.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  // Class header file.
  #include "XalanSourceTreeParserLiaison.hpp"
  
  
  
  #include <algorithm>
  
  
  
  //#include <framework/URLInputSource.hpp>
  //#include <parsers/DOMParser.hpp>
  //#include <parsers/SAXParser.hpp>
  #include <sax2/XMLReaderFactory.hpp>
  
  
  
  #include <Include/XalanAutoPtr.hpp>
  
  
  
  #include <PlatformSupport/STLHelper.hpp>
  #include <PlatformSupport/XalanUnicode.hpp>
  
  
  
  #include "XalanSourceTreeContentHandler.hpp"
  #include "XalanSourceTreeDOMSupport.hpp"
  #include "XalanSourceTreeDocument.hpp"
  
  
  
  
XalanSourceTreeParserLiaison::XalanSourceTreeParserLiaison(XalanSourceTreeDOMSupport&
 theSupport) :
        m_xercesDOMSupport(),
        m_xercesParserLiaison(m_xercesDOMSupport),
        m_documentMap(),
        m_domSupport(theSupport)
  {
  }
  
  
  
  XalanSourceTreeParserLiaison::~XalanSourceTreeParserLiaison()
  {
        reset();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::reset()
  {
  #if !defined(XALAN_NO_NAMESPACES)
        using std::for_each;
  #endif
  
        // Delete any live documents.
        for_each(m_documentMap.begin(),
                         m_documentMap.end(),
                         makeMapValueDeleteFunctor(m_documentMap));
  
        m_documentMap.clear();
  
        m_domSupport.reset();
  
        m_xercesParserLiaison.reset();
  
        m_xercesDOMSupport.reset();
  }
  
  
  
  bool
  XalanSourceTreeParserLiaison::supportsSAX() const
  {
        return m_xercesParserLiaison.supportsSAX();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::parseXMLStream(
                        const InputSource&              inputSource,
                        DocumentHandler&                handler,
                        const XalanDOMString&   identifier)
  {
        m_xercesParserLiaison.parseXMLStream(inputSource, handler, identifier);
  }
  
  
  
  XalanDocument*
  XalanSourceTreeParserLiaison::parseXMLStream(
                        const InputSource&              inputSource,
                        const XalanDOMString&   /* identifier */)
  {
        XalanSourceTreeContentHandler   
theContentHandler(createXalanSourceTreeDocument());
  
        XalanAutoPtr<SAX2XMLReader>             
theReader(XMLReaderFactory::createXMLReader());
  
        theReader->setContentHandler(&theContentHandler);
  
        theReader->setDTDHandler(&theContentHandler);
  
        theReader->setErrorHandler(&m_xercesParserLiaison);
  
        theReader->parse(inputSource);
  
        XalanSourceTreeDocument* const  theDocument = 
theContentHandler.detachDocument();
  
        return theDocument;
  }
  
  
  
  XalanDocument*
  XalanSourceTreeParserLiaison::createDocument()
  {
        return m_xercesParserLiaison.createDocument();
  }
  
  
  
  XalanDocument*
  XalanSourceTreeParserLiaison::getDOMFactory()
  {
        return m_xercesParserLiaison.createDocument();
  }
  
  
  
  /**
   * Returns the element name with the namespace expanded.
   */
  const XalanDOMString&
  XalanSourceTreeParserLiaison::getExpandedElementName(const XalanElement&      
elem) const
  {
        return m_domSupport.getExpandedElementName(elem);
  }
  
  
  
  /**
   * Returns the attribute name with the namespace expanded.
   */
  const XalanDOMString&
  XalanSourceTreeParserLiaison::getExpandedAttributeName(const XalanAttr&       
        attr) const
  {
        return m_domSupport.getExpandedAttributeName(attr);
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::setSpecialCharacters(const XalanDOMString&      
str)
  {
        m_xercesParserLiaison.setSpecialCharacters(str);
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeParserLiaison::getSpecialCharacters() const
  {
        return m_xercesParserLiaison.getSpecialCharacters();
  }
  
  
  
  int
  XalanSourceTreeParserLiaison::getIndent() const
  {
        return m_xercesParserLiaison.getIndent();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::setIndent(int           i)
  {
        m_xercesParserLiaison.setIndent(i);
  }
  
  
  
  bool
  XalanSourceTreeParserLiaison::getShouldExpandEntityRefs() const
  {
        return m_xercesParserLiaison.getShouldExpandEntityRefs();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::SetShouldExpandEntityRefs(bool  b)
  {
        m_xercesParserLiaison.SetShouldExpandEntityRefs(b);
  }
  
  
  
  bool
  XalanSourceTreeParserLiaison::getUseValidation() const
  {
        return m_xercesParserLiaison.getUseValidation();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::setUseValidation(bool           b)
  {
        m_xercesParserLiaison.setUseValidation(b);
  }
  
  
  
  const XalanDOMString
  XalanSourceTreeParserLiaison::getParserDescription() const
  {
        return XALAN_STATIC_UCODE_STRING("XalanSourceTree");
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::parseXMLStream(
                        const InputSource&              theInputSource,
                        ContentHandler&                 theContentHandler,
                        const XalanDOMString&   /* theIdentifier */)
  {
        XalanAutoPtr<SAX2XMLReader>             
theReader(XMLReaderFactory::createXMLReader());
  
        theReader->setContentHandler(&theContentHandler);
  
        theReader->setErrorHandler(&m_xercesParserLiaison);
  
        theReader->parse(theInputSource);
  }
  
  
  
  bool
  XalanSourceTreeParserLiaison::getIncludeIgnorableWhitespace() const
  {
        return m_xercesParserLiaison.getIncludeIgnorableWhitespace();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::setIncludeIgnorableWhitespace(bool      include)
  {
        m_xercesParserLiaison.setIncludeIgnorableWhitespace(include);
  }
  
  
  
  ErrorHandler*
  XalanSourceTreeParserLiaison::getErrorHandler()
  {
        return m_xercesParserLiaison.getErrorHandler();
  }
  
  
  
  const ErrorHandler*
  XalanSourceTreeParserLiaison::getErrorHandler() const
  {
        return m_xercesParserLiaison.getErrorHandler();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::setErrorHandler(ErrorHandler*   handler)
  {
        m_xercesParserLiaison.setErrorHandler(handler);
  }
  
  
  
  bool
  XalanSourceTreeParserLiaison::getDoNamespaces() const
  {
        return m_xercesParserLiaison.getDoNamespaces();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::setDoNamespaces(bool    newState)
  {
        m_xercesParserLiaison.setDoNamespaces(newState);
  }
  
  
  
  bool
  XalanSourceTreeParserLiaison::getExitOnFirstFatalError() const
  {
        return m_xercesParserLiaison.getExitOnFirstFatalError();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::setExitOnFirstFatalError(bool           
newState)
  {
        m_xercesParserLiaison.setExitOnFirstFatalError(newState);
  }
  
  
  
  EntityResolver*
  XalanSourceTreeParserLiaison::getEntityResolver()
  {
        return m_xercesParserLiaison.getEntityResolver();
  }
  
  
  
  const EntityResolver*
  XalanSourceTreeParserLiaison::getEntityResolver() const
  {
        return m_xercesParserLiaison.getEntityResolver();
  }
  
  
  
  void
  XalanSourceTreeParserLiaison::setEntityResolver(EntityResolver*       
resolver)
  {
        m_xercesParserLiaison.setEntityResolver(resolver);
  }
  
  
  
  XalanSourceTreeDocument*
  XalanSourceTreeParserLiaison::mapDocument(const XalanDocument*        
theDocument) const
  {
        const DocumentMapType::const_iterator   i =
                m_documentMap.find(theDocument);
  
        return i != m_documentMap.end() ? (*i).second : 0;
  }
  
  
  
  XalanSourceTreeDocument*
  XalanSourceTreeParserLiaison::createXalanSourceTreeDocument()
  {
        XalanSourceTreeDocument* const  theNewDocument =
                new XalanSourceTreeDocument;
  
        m_documentMap[theNewDocument] = theNewDocument;
  
        return theNewDocument;
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeParserLiaison.hpp
  
  Index: XalanSourceTreeParserLiaison.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *      notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *      notice, this list of conditions and the following disclaimer in
   *      the documentation and/or other materials provided with the
   *      distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *      if any, must include the following acknowledgment:  
   *             "This product includes software developed by the
   *              Apache Software Foundation (http://www.apache.org/)."
   *      Alternately, this acknowledgment may appear in the software itself,
   *      if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *      not be used to endorse or promote products derived from this
   *      software without prior written permission. For written 
   *      permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *      nor may "Apache" appear in their name, without prior written
   *      permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.        IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680)
  #define XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680
  
  
  // Base include file.  Must be first.
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  // Standard Library header files.
  #include <map>
  
  
  
  #include <XercesParserLiaison/XercesDOMSupport.hpp>
  #include <XercesParserLiaison/XercesParserLiaison.hpp>
  
  
  
  class ContentHandler;
  class XalanSourceTreeDOMSupport;
  class XalanSourceTreeDocument;
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT  XalanSourceTreeParserLiaison : public 
XMLParserLiaison
  {
  public:
  
        /**
         * Construct a XalanSourceTreeParserLiaison instance.
         *
         * @param theSupport instance of DOMSupport object
         */
        XalanSourceTreeParserLiaison(XalanSourceTreeDOMSupport&         
theSupport);
  
        virtual
        ~XalanSourceTreeParserLiaison();
  
        // These interfaces are inherited from XMLParserLiaison...
  
        virtual void
        reset();
  
        virtual bool
        supportsSAX() const;
  
        virtual XalanDocument*
        parseXMLStream(
                        const InputSource&              reader,
                        const XalanDOMString&   identifier = XalanDOMString());
  
        virtual void
        parseXMLStream(
                        const InputSource&              inputSource,
                        DocumentHandler&                handler,
                        const XalanDOMString&   identifier = XalanDOMString());
  
        virtual XalanDocument*
        createDocument();
  
        virtual XalanDocument*
        getDOMFactory();
  
        virtual const XalanDOMString&
        getExpandedElementName(const XalanElement&      elem) const;
  
        virtual const XalanDOMString&
        getExpandedAttributeName(const XalanAttr&       attr) const;
  
        virtual void
        setSpecialCharacters(const XalanDOMString&      str);
  
        virtual const XalanDOMString&
        getSpecialCharacters() const;
  
        virtual int
        getIndent() const;
  
        virtual void
        setIndent(int   i);
  
        virtual bool
        getShouldExpandEntityRefs() const;
  
        virtual void
        SetShouldExpandEntityRefs(bool  b);
  
        virtual bool
        getUseValidation() const;
  
        virtual void
        setUseValidation(bool   b);
  
        virtual const XalanDOMString
        getParserDescription() const;
  
  
        // These interfaces are new to XalanSourceTreeParserLiaison...
  
        /**
         * Parse using a SAX2 ContentHandler.
         *
         * @param theInputSource The input source for the parser
         * @param theContentHandler The ContentHandler to use
         * @param identifier Used for error reporting only.
         */
        virtual void
        parseXMLStream(
                        const InputSource&              theInputSource,
                        ContentHandler&                 theContentHandler,
                        const XalanDOMString&   theIdentifier = 
XalanDOMString());
  
        /** Get the 'include ignorable whitespace' flag.
          *
          * This method returns the state of the parser's include ignorable
          * whitespace flag.
          *
          * @return 'true' if the include ignorable whitespace flag is set on
          *             the parser, 'false' otherwise.
          *
          * @see #setIncludeIgnorableWhitespace
          */
        virtual bool
        getIncludeIgnorableWhitespace() const;
  
        /** Set the 'include ignorable whitespace' flag
          *
          * This method allows the user to specify whether a validating parser
          * should include ignorable whitespaces as text nodes.  It has no 
effect
          * on non-validating parsers which always include non-markup text.
          * <p>When set to true (also the default), ignorable whitespaces will 
be
          * added to the DOM tree as text nodes.  The method
          * DOM_Text::isIgnorableWhitespace() will return true for those text
          * nodes only.
          * <p>When set to false, all ignorable whitespace will be discarded and
          * no text node is added to the DOM tree.      Note: applications 
intended
          * to process the "xml:space" attribute should not set this flag to 
false.
          *
          * @param include The new state of the include ignorable whitespace
          *                        flag.
          *
          * @see #getIncludeIgnorableWhitespace
          */
        virtual void
        setIncludeIgnorableWhitespace(bool      include);
  
        /**
          * This method returns the installed error handler. Suitable
          * for 'lvalue' usages.
          *
          * @return The pointer to the installed error handler object.
          */
        virtual ErrorHandler*
        getErrorHandler();
  
        /**
          * This method returns the installed error handler. Suitable
          * for 'rvalue' usages.
          *
          * @return A const pointer to the installed error handler object.
          */
        virtual const ErrorHandler*
        getErrorHandler() const;
  
        /**
          * This method installs the user specified error handler on
          * the parser.
          *
          * @param handler A pointer to the error handler to be called
          *                        when the parser comes across 'error' events
          *                        as per the SAX specification.
          *
          * @see Parser#setErrorHandler
          */
        virtual void
        setErrorHandler(ErrorHandler*   handler);
  
        /**
          * This method returns the state of the parser's namespace
          * handling capability.
          *
          * @return true, if the parser is currently configured to
          *             understand namespaces, false otherwise.
          *
          * @see #setDoNamespaces
          */
        virtual bool
        getDoNamespaces() const;
  
        /**
          * This method allows users to enable or disable the parser's
          * namespace processing. When set to true, parser starts enforcing
          * all the constraints / rules specified by the NameSpace
          * specification.
          *
          * <p>The parser's default state is: false.</p>
          *
          * <p>This flag is ignored by the underlying scanner if the installed
          * validator indicates that namespace constraints should be
          * enforced.</p>
          *
          * @param newState The value specifying whether NameSpace rules should
          *                             be enforced or not.
          *
          * @see #getDoNamespaces
          */
        virtual void
        setDoNamespaces(bool    newState);
  
        /**
          * This method returns the state of the parser's
          * exit-on-First-Fatal-Error flag.
          *
          * @return true, if the parser is currently configured to
          *             exit on the first fatal error, false otherwise.
          *
          * @see #setExitOnFirstFatalError
          */
        virtual bool
        getExitOnFirstFatalError() const;
  
        /**
          * This method allows users to set the parser's behaviour when it
          * encounters the first fatal error. If set to true, the parser
          * will exit at the first fatal error. If false, then it will
          * report the error and continue processing.
          *
          * <p>The default value is 'true' and the parser exits on the
          * first fatal error.</p>
          *
          * @param newState The value specifying whether the parser should
          *                             continue or exit when it encounters the 
first
          *                             fatal error.
          *
          * @see #getExitOnFirstFatalError
          */
        virtual void
        setExitOnFirstFatalError(bool   newState);
  
        /**
          * This method returns the installed entity resolver. Suitable
          * for 'lvalue' usages.
          *
          * @return The pointer to the installed entity resolver object.
          */
        virtual EntityResolver*
        getEntityResolver();
  
        /**
          * This method returns the installed entity resolver. Suitable
          * for 'rvalue' usages.
          *
          * @return A const pointer to the installed entity resolver object.
          */
        virtual const EntityResolver*
        getEntityResolver() const;
  
        /**
          * This method installs the user specified entity resolver on the
          * parser. It allows applications to trap and redirect calls to
          * external entities.
          *
          * @param handler A pointer to the entity resolver to be called
          *                        when the parser comes across references to
          *                        entities in the XML file.
          *
          * @see Parser#setEntityResolver
          */
        virtual void
        setEntityResolver(EntityResolver*       resolver);
  
        /** 
         * Map a pointer to a XalanDocument instance to its implementation
         * class pointer.  Normally, you should have no reason for doing
         * this.  The liaison will return a null pointer if it did not
         * create the instance passed.
         *
         * @param theDocument A pointer to a XalanDocument instance.
         * @return A pointer to the XalanSourceTreeDocument instance.
         */
        XalanSourceTreeDocument*
        mapDocument(const XalanDocument*        theDocument) const;
  
  #if defined(XALAN_NO_NAMESPACES)
        typedef map<const XalanDocument*,
                                XalanSourceTreeDocument*,
                                less<const XalanDocument*> >    DocumentMapType;
  #else
        typedef std::map<const XalanDocument*,
                                         XalanSourceTreeDocument*>      
DocumentMapType;
  #endif
  
  private:
  
        XalanSourceTreeDocument*
        createXalanSourceTreeDocument();
  
  
        // Data members...
        XercesDOMSupport                                m_xercesDOMSupport;     
// Must be before m_xercesParserLiaison!!!
  
        XercesParserLiaison                             m_xercesParserLiaison;
  
        DocumentMapType                                 m_documentMap;
  
        XalanSourceTreeDOMSupport&              m_domSupport;
  };
  
  
  
  #endif        // XALANSOURCETREEPARSERLIAISON_HEADER_GUARD_1357924680
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeProcessingInstruction.cpp
  
  Index: XalanSourceTreeProcessingInstruction.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeProcessingInstruction.hpp"
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  #include <PlatformSupport/DOMStringHelper.hpp>
  
  
  
  #include "XalanSourceTreeComment.hpp"
  #include "XalanSourceTreeCDATASection.hpp"
  #include "XalanSourceTreeDocument.hpp"
  #include "XalanSourceTreeElement.hpp"
  #include "XalanSourceTreeText.hpp"
  #include "XalanSourceTreeHelper.hpp"
  
  
  
  static const XalanDOMString           s_emptyString;
  
  
  
  XalanSourceTreeProcessingInstruction::XalanSourceTreeProcessingInstruction(
                        const XalanDOMString&           theTarget,
                        const XalanDOMString&           theData,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex) :
        XalanProcessingInstruction(),
        m_target(theTarget),
        m_data(theData),
        m_ownerDocument(theOwnerDocument),
        m_parentElement(theParentElement),
        m_previousSibling(thePreviousSibling),
        m_nextSibling(theNextSibling),
        m_index(theIndex)
  {
  }
  
  
  
  XalanSourceTreeProcessingInstruction::~XalanSourceTreeProcessingInstruction()
  {
  }
  
  
  
  XalanSourceTreeProcessingInstruction::XalanSourceTreeProcessingInstruction(
                        const XalanSourceTreeProcessingInstruction&             
theSource,
                        bool                                                    
                                /* deep */) :
        XalanProcessingInstruction(theSource),
        m_target(theSource.m_target),
        m_data(theSource.m_data),
        m_parentElement(0),
        m_previousSibling(0),
        m_nextSibling(0),
        m_index(0)
  {
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeProcessingInstruction::getNodeName() const
  {
        return m_target;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeProcessingInstruction::getNodeValue() const
  {
        return m_data;
  }
  
  
  
  XalanSourceTreeProcessingInstruction::NodeType
  XalanSourceTreeProcessingInstruction::getNodeType() const
  {
        return PROCESSING_INSTRUCTION_NODE;
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::getParentNode() const
  {
        assert(m_ownerDocument != 0);
  
        return m_ownerDocument;
  }
  
  
  
  const XalanNodeList*
  XalanSourceTreeProcessingInstruction::getChildNodes() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::getFirstChild() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::getLastChild() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::getPreviousSibling() const
  {
        return m_previousSibling;
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::getNextSibling() const
  {
        return m_nextSibling;
  }
  
  
  
  const XalanNamedNodeMap*
  XalanSourceTreeProcessingInstruction::getAttributes() const
  {
        return 0;
  }
  
  
  
  XalanDocument*
  XalanSourceTreeProcessingInstruction::getOwnerDocument() const
  {
        assert(m_ownerDocument != 0);
  
        return m_ownerDocument;
  }
  
  
  
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
  XalanNode*
  #else
  XalanSourceTreeProcessingInstruction*
  #endif
  XalanSourceTreeProcessingInstruction::cloneNode(bool  deep) const
  {
        return new XalanSourceTreeProcessingInstruction(*this, deep);
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::insertBefore(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* refChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::replaceChild(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::removeChild(XalanNode*  /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeProcessingInstruction::appendChild(XalanNode*  /* newChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  bool
  XalanSourceTreeProcessingInstruction::hasChildNodes() const
  {
        return false;
  }
  
  
  
  void
  XalanSourceTreeProcessingInstruction::setNodeValue(const XalanDOMString&      
        /* nodeValue */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeProcessingInstruction::normalize()
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeProcessingInstruction::supports(
                        const XalanDOMString&   /* feature */,
                        const XalanDOMString&   /* version */) const
  {
        return false;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeProcessingInstruction::getNamespaceURI() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeProcessingInstruction::getPrefix() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeProcessingInstruction::getLocalName() const
  {
        return s_emptyString;
  }
  
  
  
  void
  XalanSourceTreeProcessingInstruction::setPrefix(const XalanDOMString& /* 
prefix */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeProcessingInstruction::isIndexed() const
  {
        return true;
  }
  
  
  
  unsigned long
  XalanSourceTreeProcessingInstruction::getIndex() const
  {
        return m_index;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeProcessingInstruction::getTarget() const
  {
        return m_target;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeProcessingInstruction::getData() const
  {
        return m_data;
  }
  
  
  
  void
  XalanSourceTreeProcessingInstruction::setData(const XalanDOMString&           
/* theData */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  
XalanSourceTreeProcessingInstruction::setPreviousSibling(XalanSourceTreeComment*
      thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  
XalanSourceTreeProcessingInstruction::setPreviousSibling(XalanSourceTreeCDATASection*
 thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  
XalanSourceTreeProcessingInstruction::setPreviousSibling(XalanSourceTreeElement*
      thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  
XalanSourceTreeProcessingInstruction::setPreviousSibling(XalanSourceTreeProcessingInstruction*
        thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeProcessingInstruction::setPreviousSibling(XalanSourceTreeText* 
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  
XalanSourceTreeProcessingInstruction::appendSiblingNode(XalanSourceTreeComment* 
              theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  
XalanSourceTreeProcessingInstruction::appendSiblingNode(XalanSourceTreeCDATASection*
  theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  
XalanSourceTreeProcessingInstruction::appendSiblingNode(XalanSourceTreeElement* 
              theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  
XalanSourceTreeProcessingInstruction::appendSiblingNode(XalanSourceTreeProcessingInstruction*
 theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeProcessingInstruction::appendSiblingNode(XalanSourceTreeText*  
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeProcessingInstruction.hpp
  
  Index: XalanSourceTreeProcessingInstruction.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREEPROCESSINGINSTRUCTION_HEADER_GUARD_1357924680)
  #define XALANSOURCETREEPROCESSINGINSTRUCTION_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanDOM/XalanProcessingInstruction.hpp>
  
  
  
  #include <XalanDOM/XalanDOMString.hpp>
  
  
  
  class XalanSourceTreeComment;
  class XalanSourceTreeCDATASection;
  class XalanSourceTreeDocument;
  class XalanSourceTreeElement;
  class XalanSourceTreeText;
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeProcessingInstruction : 
public XalanProcessingInstruction
  {
  public:
  
        /**
         * Create an instance.
         * 
         * @param theTarget The target for the processing instruction.
         * @param theData The data for the node
         * @param theOwnerDocument The document that owns the instance.
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The next sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        XalanSourceTreeProcessingInstruction(
                        const XalanDOMString&           theTarget,
                        const XalanDOMString&           theData,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        virtual
        ~XalanSourceTreeProcessingInstruction();
  
  
        // These interfaces are inherited from XalanNode...
  
        virtual const XalanDOMString&
        getNodeName() const;
  
        /**
         * Gets the value of this node, depending on its type.
         */
        virtual const XalanDOMString&
        getNodeValue() const;
  
        /**
         * An enum value representing the type of the underlying object.
         */
        virtual NodeType
        getNodeType() const;
  
        /**
         * Gets the parent of this node.
         *
         * All nodes, except <code>Document</code>,
         * <code>DocumentFragment</code>, and <code>Attr</code> may have a 
parent.
         * However, if a node has just been created and not yet added to the 
tree,
         * or if it has been removed from the tree, a <code>null</code> DOM_Node
         * is returned.
         */
        virtual XalanNode*
        getParentNode() const;
  
        /**
         * Gets a <code>NodeList</code> that contains all children of this node.
         *
         * If there
         * are no children, this is a <code>NodeList</code> containing no nodes.
         * The content of the returned <code>NodeList</code> is "live" in the 
sense
         * that, for instance, changes to the children of the node object that
         * it was created from are immediately reflected in the nodes returned 
by
         * the <code>NodeList</code> accessors; it is not a static snapshot of 
the
         * content of the node. This is true for every <code>NodeList</code>,
         * including the ones returned by the <code>getElementsByTagName</code>
         * method.
         */
        virtual const XalanNodeList*
        getChildNodes() const;
  
        /**
         * Gets the first child of this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getFirstChild() const;
  
        /**
         * Gets the last child of this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getLastChild() const;
  
        /**
         * Gets the node immediately preceding this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getPreviousSibling() const;
  
        /**
         * Gets the node immediately following this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getNextSibling() const;
  
        /**
         * Gets a <code>NamedNodeMap</code> containing the attributes of this 
node (if it
         * is an <code>Element</code>) or <code>null</code> otherwise.
         */
        virtual const XalanNamedNodeMap*
        getAttributes() const;
  
        /**
         * Gets the <code>DOM_Document</code> object associated with this node.
         *
         * This is also
         * the <code>DOM_Document</code> object used to create new nodes. When 
this
         * node is a <code>DOM_Document</code> or a 
<code>DOM_DocumentType</code>
         * which is not used with any <code>DOM_Document</code> yet, this is
         * <code>null</code>.
         */
        virtual XalanDocument*
        getOwnerDocument() const;
  
        //@}
        /** @name Cloning function. */
        //@{
  
        /**
         * Returns a duplicate of this node.
         *
         * This function serves as a generic copy constructor for nodes.
         *
         * The duplicate node has no parent (
         * <code>parentNode</code> returns <code>null</code>.).
         * <br>Cloning an <code>Element</code> copies all attributes and their
         * values, including those generated by the  XML processor to represent
         * defaulted attributes, but this method does not copy any text it 
contains
         * unless it is a deep clone, since the text is contained in a child
         * <code>Text</code> node. Cloning any other type of node simply 
returns a
         * copy of this node.
         * @param deep If <code>true</code>, recursively clone the subtree 
under the
         *       specified node; if <code>false</code>, clone only the node 
itself (and
         *       its attributes, if it is an <code>Element</code>).
         * @return The duplicate node.
         */
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
        virtual XalanNode*
  #else
        virtual XalanSourceTreeProcessingInstruction*
  #endif
        cloneNode(bool deep) const;
  
        //@}
        /** @name Functions to modify the DOM Node. */
        //@{
  
        /**
         * Inserts the node <code>newChild</code> before the existing child node
         * <code>refChild</code>.
         *
         * If <code>refChild</code> is <code>null</code>,
         * insert <code>newChild</code> at the end of the list of children.
         * <br>If <code>newChild</code> is a <code>DocumentFragment</code> 
object,
         * all of its children are inserted, in the same order, before
         * <code>refChild</code>. If the <code>newChild</code> is already in the
         * tree, it is first removed.  Note that a <code>DOM_Node</code> that
         * has never been assigned to refer to an actual node is == null.
         * @param newChild The node to insert.
         * @param refChild The reference node, i.e., the node before which the 
new
         *       node must be inserted.
         * @return The node being inserted.
         */
        virtual XalanNode*
        insertBefore(
                        XalanNode*      newChild,
                        XalanNode*      refChild);
  
        /**
         * Replaces the child node <code>oldChild</code> with 
<code>newChild</code>
         * in the list of children, and returns the <code>oldChild</code> node.
         *
         * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> 
object,
         * <CODE>oldChild</CODE> is replaced by all of the 
<CODE>DOM_DocumentFragment</CODE>
         * children, which are inserted in the same order.
         *
         * If the <code>newChild</code> is already in the tree, it is first 
removed.
         * @param newChild The new node to put in the child list.
         * @param oldChild The node being replaced in the list.
         * @return The node replaced.
         */
        virtual XalanNode*
        replaceChild(
                        XalanNode*      newChild,
                        XalanNode*      oldChild);
  
        /**
         * Removes the child node indicated by <code>oldChild</code> from the 
list
         * of children, and returns it.
         *
         * @param oldChild The node being removed.
         * @return The node removed.
         */
        virtual XalanNode*
        removeChild(XalanNode*  oldChild);
  
        /**
         * Adds the node <code>newChild</code> to the end of the list of 
children of
         * this node.
         *
         * If the <code>newChild</code> is already in the tree, it is
         * first removed.
         * @param newChild The node to add.If it is a  
<code>DocumentFragment</code>
         *       object, the entire contents of the document fragment are moved 
into
         *       the child list of this node
         * @return The node added.
         */
        virtual XalanNode*
        appendChild(XalanNode*  newChild);
  
        //@}
        /** @name Query functions. */
        //@{
  
        /**
         *      This is a convenience method to allow easy determination of 
whether a
         * node has any children.
         *
         * @return      <code>true</code> if the node has any children,
         *       <code>false</code> if the node has no children.
         */
        virtual bool
        hasChildNodes() const;
  
  
        //@}
        /** @name Set functions. */
        //@{
  
  
        /**
        * Sets the value of the node.
        *
        * Any node which can have a nodeValue (@see getNodeValue) will
        * also accept requests to set it to a string. The exact response to
        * this varies from node to node -- Attribute, for example, stores
        * its values in its children and has to replace them with a new Text
        * holding the replacement value.
        *
        * For most types of Node, value is null and attempting to set it
        * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
        * also be thrown if the node is read-only.
        */
        virtual void
        setNodeValue(const XalanDOMString&      nodeValue);
  
        //@}
        /** @name Functions introduced in DOM Level 2. */
        //@{
  
        /**
         * Puts all <CODE>DOM_Text</CODE>
         * nodes in the full depth of the sub-tree underneath this 
<CODE>DOM_Node</CODE>, 
         * including attribute nodes, into a "normal" form where only markup 
(e.g., 
         * tags, comments, processing instructions, CDATA sections, and entity 
         * references) separates <CODE>DOM_Text</CODE>
         * nodes, i.e., there are no adjacent <CODE>DOM_Text</CODE>
         * nodes. This can be used to ensure that the DOM view of a document is 
the 
         * same as if it were saved and re-loaded, and is useful when 
operations 
         * (such as XPointer lookups) that depend on a particular document tree 
         * structure are to be used.
         * <P><B>Note:</B> In cases where the document contains 
<CODE>DOM_CDATASections</CODE>, 
         * the normalize operation alone may not be sufficient, since XPointers 
do 
         * not differentiate between <CODE>DOM_Text</CODE>
         * nodes and <CODE>DOM_CDATASection</CODE> nodes.</P>
         */
        virtual void
        normalize();
  
        /**
         * Tests whether the DOM implementation implements a specific
         * feature and that feature is supported by this node.
         * @param feature The string of the feature to test. This is the same
         * name as what can be passed to the method <code>hasFeature</code> on
         * <code>DOMImplementation</code>.
         * @param version This is the version number of the feature to test. In
         * Level 2, version 1, this is the string "2.0". If the version is not
         * specified, supporting any version of the feature will cause the
         * method to return <code>true</code>.
         * @return Returns <code>true</code> if the specified feature is 
supported
         * on this node, <code>false</code> otherwise.
         */
        virtual bool
        supports(
                        const XalanDOMString&   feature,
                        const XalanDOMString&   version) const;
  
        /**
         * Get the <em>namespace URI</em> of
         * this node, or <code>null</code> if it is unspecified.
         * <p>
         * This is not a computed value that is the result of a namespace lookup
         * based on an examination of the namespace declarations in scope. It is
         * merely the namespace URI given at creation time.
         * <p>
         * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and 
         * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 
method, 
         * such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
         * interface, this is always <CODE>null</CODE>.
         */
        virtual const XalanDOMString&
        getNamespaceURI() const;
  
        /**
         * Get the <em>namespace prefix</em>
         * of this node, or <code>null</code> if it is unspecified.
         */
        virtual const XalanDOMString&
        getPrefix() const;
  
        /**
         * Returns the local part of the <em>qualified name</em> of this node.
         * <p>
         * For nodes created with a DOM Level 1 method, such as
         * <code>createElement</code> from the <code>DOM_Document</code> 
interface,
         * it is null.
         */
        virtual const XalanDOMString&
        getLocalName() const;
  
        /**
         * Set the <em>namespace prefix</em> of this node.
         * <p>
         * Note that setting this attribute, when permitted, changes 
         * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified 
         * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE> 
         * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE>
         * interfaces, when applicable.
         * <p>
         * Note also that changing the prefix of an 
         * attribute, that is known to have a default value, does not make a 
new 
         * attribute with the default value and the original prefix appear, 
since the 
         * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
         *
         * @param prefix The prefix of this node.
         * @exception DOMException
         *       INVALID_CHARACTER_ERR: Raised if the specified prefix contains
         *                                                      an illegal 
character.
         * <br>
         *       NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         * <br>
         *       NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is 
         *               malformed, if the specified prefix is "xml" and the 
         *               <CODE>namespaceURI</CODE> of this node is different 
from 
         *               "http://www.w3.org/XML/1998/namespace";, if specified 
prefix is 
         *               "xmlns" and the <CODE>namespaceURI</CODE> is neither 
         *               <CODE>null</CODE> nor an empty string, or if the 
         *               <CODE>localName</CODE> is <CODE>null</CODE>.
         */
        virtual void
        setPrefix(const XalanDOMString& prefix);
  
        virtual bool
        isIndexed() const;
  
        virtual unsigned long
        getIndex() const;
  
        //@}
  
        // These interfaces are inherited from XalanProcessingInstruction...
  
      //@}
      /** @name Get functions. */
      //@{
      /**
       * The target of this processing instruction. 
       *
       * XML defines this as being the 
       * first token following the markup that begins the processing 
instruction.
       */
      virtual const XalanDOMString&
        getTarget() const;
  
      /**
       * The content of this processing instruction. 
       *
       * This is from the first non 
       * white space character after the target to the character immediately 
       * preceding the <code>?&gt;</code>.
       * @exception DOMException
       *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
       */
      virtual const XalanDOMString&
        getData() const;
  
      //@}
      /** @name Set functions. */
      //@{
      /**
      * Sets the content of this processing instruction. 
      *
      * This is from the first non 
      * white space character after the target to the character immediately 
      * preceding the <code>?&gt;</code>.
      * @param data The string containing the processing instruction
      */
      virtual void
        setData(const XalanDOMString&   data);
      //@}
  
  
        // public interfaces not inherited from XalanProcessingInstruction...
  
        XalanSourceTreeElement*
        getParentElement() const
        {
                return m_parentElement;
        }
  
        void
        setParentElement(XalanSourceTreeElement*        theParentElement)
        {
                m_parentElement = theParentElement;
        }
  
        void
        setPreviousSibling(XalanSourceTreeComment*      thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeCDATASection*         
thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeElement*      thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeProcessingInstruction*        
thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeText*         thePreviousSibling);
  
        void
        appendSiblingNode(XalanSourceTreeComment*       theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeCDATASection*  theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeElement*       theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeProcessingInstruction*         
theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeText*  theSibling);
  
        void
        setIndex(unsigned int   theIndex)
        {
                m_index = theIndex;
        }
  
  protected:
  
        XalanSourceTreeProcessingInstruction(
                        const XalanSourceTreeProcessingInstruction&             
theSource,
                        bool                                                    
                                deep = false);
  
  private:
  
        // Not implemented...
        XalanSourceTreeProcessingInstruction&
        operator=(const XalanSourceTreeProcessingInstruction&   theSource);
  
        bool
        operator==(const XalanSourceTreeProcessingInstruction&          theRHS) 
const;
  
  
        // Data members...
        const XalanDOMString&           m_target;
  
        const XalanDOMString&           m_data;
  
        XalanSourceTreeDocument*        m_ownerDocument;
  
        XalanSourceTreeElement*         m_parentElement;
  
        XalanNode*                                      m_previousSibling;
  
        XalanNode*                                      m_nextSibling;
  
        unsigned int                            m_index;
  };
  
  
  
  #endif        // 
!defined(XALANSOURCETREEPROCESSINGINSTRUCTION_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.cpp
  
  Index: XalanSourceTreeProcessingInstructionAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanSourceTreeProcessingInstructionAllocator.hpp"
  
  
  
  
XalanSourceTreeProcessingInstructionAllocator::XalanSourceTreeProcessingInstructionAllocator(size_type
        theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  
XalanSourceTreeProcessingInstructionAllocator::~XalanSourceTreeProcessingInstructionAllocator()
  {
  }
  
  
  
  XalanSourceTreeProcessingInstructionAllocator::ObjectType*
  XalanSourceTreeProcessingInstructionAllocator::create(
                        const XalanDOMString&           theTarget,
                        const XalanDOMString&           theData,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex)
  {
        ObjectType* const       theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        new(theBlock) ObjectType(
                                                theTarget,
                                                theData,
                                                theOwnerDocument,
                                                theParentElement,
                                                thePreviousSibling,
                                                theNextSibling,
                                                theIndex);
  
        m_allocator.commitAllocation(theBlock);
  
        return theBlock;
  }
  
  
  
  void 
  XalanSourceTreeProcessingInstructionAllocator::reset()
  {
        m_allocator.reset();
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeProcessingInstructionAllocator.hpp
  
  Index: XalanSourceTreeProcessingInstructionAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if 
!defined(XALANSOURCETREEPROCESSINGINSTRUCTIONALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANSOURCETREEPROCESSINGINSTRUCTIONALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeProcessingInstruction.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT 
XalanSourceTreeProcessingInstructionAllocator
  {
  public:
  
        typedef XalanSourceTreeProcessingInstruction    ObjectType;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<ObjectType>                                  
ArenaBlockType;
  
        typedef ArenaAllocator<ObjectType,
                                                   ArenaBlockType>              
        ArenaAllocatorType;
  #else
        typedef ArenaAllocator<ObjectType>                              
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type                   size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanSourceTreeProcessingInstructionAllocator(size_type theBlockCount);
  
        ~XalanSourceTreeProcessingInstructionAllocator();
  
        /**
         * Create an instance.
         * 
         * @param theTarget The target for the processing instruction.
         * @param theData The data for the node
         * @param theOwnerDocument The document that owns the instance.
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The next sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        ObjectType*
        create(
                        const XalanDOMString&           theTarget,
                        const XalanDOMString&           theData,
                        XalanSourceTreeDocument*        theOwnerDocument,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        /**
         * Delete all objects from allocator.    
         */     
        void
        reset();
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanSourceTreeProcessingInstructionAllocator(const 
XalanSourceTreeProcessingInstructionAllocator&);
  
        XalanSourceTreeProcessingInstructionAllocator&
        operator=(const XalanSourceTreeProcessingInstructionAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // 
XALANSOURCETREEPROCESSINGINSTRUCTIONALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  xml-xalan/c/src/XalanSourceTree/XalanSourceTreeText.cpp
  
  Index: XalanSourceTreeText.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeText.hpp"
  
  
  
  #include <XalanDOM/XalanDOMException.hpp>
  
  
  
  #include <PlatformSupport/DOMStringHelper.hpp>
  
  
  
  #include "XalanSourceTreeComment.hpp"
  #include "XalanSourceTreeCDATASection.hpp"
  #include "XalanSourceTreeElement.hpp"
  #include "XalanSourceTreeProcessingInstruction.hpp"
  #include "XalanSourceTreeHelper.hpp"
  
  
  
  static const XalanDOMString           s_emptyString;
  
  
  
  XalanSourceTreeText::XalanSourceTreeText(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex) :
        XalanText(),
        m_data(theData),
        m_parentElement(theParentElement),
        m_previousSibling(thePreviousSibling),
        m_nextSibling(theNextSibling),
        m_index(theIndex)
  {
  }
  
  
  
  XalanSourceTreeText::~XalanSourceTreeText()
  {
  }
  
  
  
  XalanSourceTreeText::XalanSourceTreeText(
                        const XalanSourceTreeText&      theSource,
                        bool                                                    
/* deep */) :
        XalanText(theSource),
        m_data(theSource.m_data),
        m_parentElement(0),
        m_previousSibling(0),
        m_nextSibling(0),
        m_index(0)
  {
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeText::getNodeName() const
  {
        return s_nameString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeText::getNodeValue() const
  {
        return m_data;
  }
  
  
  
  XalanSourceTreeText::NodeType
  XalanSourceTreeText::getNodeType() const
  {
        return TEXT_NODE;
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::getParentNode() const
  {
        return m_parentElement;
  }
  
  
  
  const XalanNodeList*
  XalanSourceTreeText::getChildNodes() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::getFirstChild() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::getLastChild() const
  {
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::getPreviousSibling() const
  {
        return m_previousSibling;
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::getNextSibling() const
  {
        return m_nextSibling;
  }
  
  
  
  const XalanNamedNodeMap*
  XalanSourceTreeText::getAttributes() const
  {
        return 0;
  }
  
  
  
  XalanDocument*
  XalanSourceTreeText::getOwnerDocument() const
  {
        assert(m_parentElement != 0);
  
        return m_parentElement->getOwnerDocument();
  }
  
  
  
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
  XalanNode*
  #else
  XalanSourceTreeText*
  #endif
  XalanSourceTreeText::cloneNode(bool   deep) const
  {
        return new XalanSourceTreeText(*this, deep);
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::insertBefore(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* refChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::replaceChild(
                        XalanNode*      /* newChild */,
                        XalanNode*      /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::removeChild(XalanNode*   /* oldChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  XalanNode*
  XalanSourceTreeText::appendChild(XalanNode*   /* newChild */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  
        // Dummy return value...
        return 0;
  }
  
  
  
  bool
  XalanSourceTreeText::hasChildNodes() const
  {
        return false;
  }
  
  
  
  void
  XalanSourceTreeText::setNodeValue(const XalanDOMString&               /* 
nodeValue */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeText::normalize()
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeText::supports(
                        const XalanDOMString&   /* feature */,
                        const XalanDOMString&   /* version */) const
  {
        return false;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeText::getNamespaceURI() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeText::getPrefix() const
  {
        return s_emptyString;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeText::getLocalName() const
  {
        return s_emptyString;
  }
  
  
  
  void
  XalanSourceTreeText::setPrefix(const XalanDOMString&  /* prefix */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeText::isIndexed() const
  {
        return true;
  }
  
  
  
  unsigned long
  XalanSourceTreeText::getIndex() const
  {
        return m_index;
  }
  
  
  
  const XalanDOMString&
  XalanSourceTreeText::getData() const
  {
        return m_data;
  }
  
  
  
  unsigned int
  XalanSourceTreeText::getLength() const
  {
        return length(m_data);
  }
  
  
  
  XalanDOMString
  XalanSourceTreeText::substringData(
                        unsigned int    offset,
                        unsigned int    count) const
  {
        return substring(m_data, offset, count);
  }
  
  
  
  void
  XalanSourceTreeText::appendData(const XalanDOMString& /* arg */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeText::insertData(
                        unsigned int                    /* offset */,
                        const  XalanDOMString&  /* arg */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeText::deleteData(
                        unsigned int    /* offset */,
                        unsigned int    /* count */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  void
  XalanSourceTreeText::replaceData(
                        unsigned int                    /* offset */,
                        unsigned int                    /* count */,
                        const XalanDOMString&   /* arg */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  XalanText*
  XalanSourceTreeText::splitText(unsigned int           /* offset */)
  {
        throw XalanDOMException(XalanDOMException::NO_MODIFICATION_ALLOWED_ERR);
  }
  
  
  
  bool
  XalanSourceTreeText::isIgnorableWhitespace() const
  {
        return false;
  }
  
  
  
  void
  XalanSourceTreeText::setPreviousSibling(XalanSourceTreeComment*               
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeText::setPreviousSibling(XalanSourceTreeCDATASection*  
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeText::setPreviousSibling(XalanSourceTreeElement*               
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeText::setPreviousSibling(XalanSourceTreeProcessingInstruction* 
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeText::setPreviousSibling(XalanSourceTreeText*  
thePreviousSibling)
  {
        m_previousSibling = thePreviousSibling;
  }
  
  
  
  void
  XalanSourceTreeText::appendSiblingNode(XalanSourceTreeComment*        
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeText::appendSiblingNode(XalanSourceTreeCDATASection*           
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeText::appendSiblingNode(XalanSourceTreeElement*        
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeText::appendSiblingNode(XalanSourceTreeProcessingInstruction*  
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  void
  XalanSourceTreeText::appendSiblingNode(XalanSourceTreeText*           
theSibling)
  {
        XalanSourceTreeHelper::appendSibling(this, m_nextSibling, theSibling);
  }
  
  
  
  static XalanDOMString s_nameString;
  
  
  
  const XalanDOMString& XalanSourceTreeText::s_nameString = ::s_nameString;
  
  
  
  void
  XalanSourceTreeText::initialize()
  {
        ::s_nameString = XALAN_STATIC_UCODE_STRING("#text");
  }
  
  
  
  void
  XalanSourceTreeText::terminate()
  {
        clear(::s_nameString);
  }
  
  
  
  1.1                  xml-xalan/c/src/XalanSourceTree/XalanSourceTreeText.hpp
  
  Index: XalanSourceTreeText.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREETEXT_HEADER_GUARD_1357924680)
  #define XALANSOURCETREETEXT_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanDOM/XalanText.hpp>
  
  
  
  #include <XalanDOM/XalanDOMString.hpp>
  
  
  
  class XalanSourceTreeComment;
  class XalanSourceTreeCDATASection;
  class XalanSourceTreeElement;
  class XalanSourceTreeProcessingInstruction;
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeText : public XalanText
  {
  public:
  
        /**
         * Perform static initialization.  See class XalanSourceTreeInit.
         */
        static void
        initialize();
  
        /**
         * Perform static shut down.  See class XalanSourceTreeInit.
         */
        static void
        terminate();
  
        /**
         * Constructor.
         *
         * @param theData The text data of the node
         * @param isIgnorableWhitespace true if the text data is only ignorable 
whitespace
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The previous sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         */
        XalanSourceTreeText(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        virtual
        ~XalanSourceTreeText();
  
  
        /**
         * Gets the name of this node.
         */
        virtual const XalanDOMString&
        getNodeName() const;
  
        /**
         * Gets the value of this node, depending on its type.
         */
        virtual const XalanDOMString&
        getNodeValue() const;
  
        /**
         * An enum value representing the type of the underlying object.
         */
        virtual NodeType
        getNodeType() const;
  
        /**
         * Gets the parent of this node.
         *
         * All nodes, except <code>Document</code>,
         * <code>DocumentFragment</code>, and <code>Attr</code> may have a 
parent.
         * However, if a node has just been created and not yet added to the 
tree,
         * or if it has been removed from the tree, a <code>null</code> DOM_Node
         * is returned.
         */
        virtual XalanNode*
        getParentNode() const;
  
        /**
         * Gets a <code>NodeList</code> that contains all children of this node.
         *
         * If there
         * are no children, this is a <code>NodeList</code> containing no nodes.
         * The content of the returned <code>NodeList</code> is "live" in the 
sense
         * that, for instance, changes to the children of the node object that
         * it was created from are immediately reflected in the nodes returned 
by
         * the <code>NodeList</code> accessors; it is not a static snapshot of 
the
         * content of the node. This is true for every <code>NodeList</code>,
         * including the ones returned by the <code>getElementsByTagName</code>
         * method.
         */
        virtual const XalanNodeList*
        getChildNodes() const;
  
        /**
         * Gets the first child of this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getFirstChild() const;
  
        /**
         * Gets the last child of this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getLastChild() const;
  
        /**
         * Gets the node immediately preceding this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getPreviousSibling() const;
  
        /**
         * Gets the node immediately following this node.
         *
         * If there is no such node, this returns <code>null</code>.
         */
        virtual XalanNode*
        getNextSibling() const;
  
        /**
         * Gets a <code>NamedNodeMap</code> containing the attributes of this 
node (if it
         * is an <code>Element</code>) or <code>null</code> otherwise.
         */
        virtual const XalanNamedNodeMap*
        getAttributes() const;
  
        /**
         * Gets the <code>DOM_Document</code> object associated with this node.
         *
         * This is also
         * the <code>DOM_Document</code> object used to create new nodes. When 
this
         * node is a <code>DOM_Document</code> or a 
<code>DOM_DocumentType</code>
         * which is not used with any <code>DOM_Document</code> yet, this is
         * <code>null</code>.
         */
        virtual XalanDocument*
        getOwnerDocument() const;
  
        //@}
        /** @name Cloning function. */
        //@{
  
        /**
         * Returns a duplicate of this node.
         *
         * This function serves as a generic copy constructor for nodes.
         *
         * The duplicate node has no parent (
         * <code>parentNode</code> returns <code>null</code>.).
         * <br>Cloning an <code>Element</code> copies all attributes and their
         * values, including those generated by the  XML processor to represent
         * defaulted attributes, but this method does not copy any text it 
contains
         * unless it is a deep clone, since the text is contained in a child
         * <code>Text</code> node. Cloning any other type of node simply 
returns a
         * copy of this node.
         * @param deep If <code>true</code>, recursively clone the subtree 
under the
         *       specified node; if <code>false</code>, clone only the node 
itself (and
         *       its attributes, if it is an <code>Element</code>).
         * @return The duplicate node.
         */
  #if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
        virtual XalanNode*
  #else
        virtual XalanSourceTreeText*
  #endif
        cloneNode(bool deep) const;
  
        //@}
        /** @name Functions to modify the DOM Node. */
        //@{
  
        /**
         * Inserts the node <code>newChild</code> before the existing child node
         * <code>refChild</code>.
         *
         * If <code>refChild</code> is <code>null</code>,
         * insert <code>newChild</code> at the end of the list of children.
         * <br>If <code>newChild</code> is a <code>DocumentFragment</code> 
object,
         * all of its children are inserted, in the same order, before
         * <code>refChild</code>. If the <code>newChild</code> is already in the
         * tree, it is first removed.  Note that a <code>DOM_Node</code> that
         * has never been assigned to refer to an actual node is == null.
         * @param newChild The node to insert.
         * @param refChild The reference node, i.e., the node before which the 
new
         *       node must be inserted.
         * @return The node being inserted.
         */
        virtual XalanNode*
        insertBefore(
                        XalanNode*      newChild,
                        XalanNode*      refChild);
  
        /**
         * Replaces the child node <code>oldChild</code> with 
<code>newChild</code>
         * in the list of children, and returns the <code>oldChild</code> node.
         *
         * If <CODE>newChild</CODE> is a <CODE>DOM_DocumentFragment</CODE> 
object,
         * <CODE>oldChild</CODE> is replaced by all of the 
<CODE>DOM_DocumentFragment</CODE>
         * children, which are inserted in the same order.
         *
         * If the <code>newChild</code> is already in the tree, it is first 
removed.
         * @param newChild The new node to put in the child list.
         * @param oldChild The node being replaced in the list.
         * @return The node replaced.
         */
        virtual XalanNode*
        replaceChild(
                        XalanNode*      newChild,
                        XalanNode*      oldChild);
  
        /**
         * Removes the child node indicated by <code>oldChild</code> from the 
list
         * of children, and returns it.
         *
         * @param oldChild The node being removed.
         * @return The node removed.
         */
        virtual XalanNode*
        removeChild(XalanNode*  oldChild);
  
        /**
         * Adds the node <code>newChild</code> to the end of the list of 
children of
         * this node.
         *
         * If the <code>newChild</code> is already in the tree, it is
         * first removed.
         * @param newChild The node to add.If it is a  
<code>DocumentFragment</code>
         *       object, the entire contents of the document fragment are moved 
into
         *       the child list of this node
         * @return The node added.
         */
        virtual XalanNode*
        appendChild(XalanNode*  newChild);
  
        //@}
        /** @name Query functions. */
        //@{
  
        /**
         *      This is a convenience method to allow easy determination of 
whether a
         * node has any children.
         *
         * @return      <code>true</code> if the node has any children,
         *       <code>false</code> if the node has no children.
         */
        virtual bool
        hasChildNodes() const;
  
  
        //@}
        /** @name Set functions. */
        //@{
  
  
        /**
        * Sets the value of the node.
        *
        * Any node which can have a nodeValue (@see getNodeValue) will
        * also accept requests to set it to a string. The exact response to
        * this varies from node to node -- Attribute, for example, stores
        * its values in its children and has to replace them with a new Text
        * holding the replacement value.
        *
        * For most types of Node, value is null and attempting to set it
        * will throw DOMException(NO_MODIFICATION_ALLOWED_ERR). This will
        * also be thrown if the node is read-only.
        */
        virtual void
        setNodeValue(const XalanDOMString&              nodeValue);
  
        //@}
        /** @name Functions introduced in DOM Level 2. */
        //@{
  
        /**
         * Puts all <CODE>DOM_Text</CODE>
         * nodes in the full depth of the sub-tree underneath this 
<CODE>DOM_Node</CODE>, 
         * including attribute nodes, into a "normal" form where only markup 
(e.g., 
         * tags, comments, processing instructions, CDATA sections, and entity 
         * references) separates <CODE>DOM_Text</CODE>
         * nodes, i.e., there are no adjacent <CODE>DOM_Text</CODE>
         * nodes. This can be used to ensure that the DOM view of a document is 
the 
         * same as if it were saved and re-loaded, and is useful when 
operations 
         * (such as XPointer lookups) that depend on a particular document tree 
         * structure are to be used.
         * <P><B>Note:</B> In cases where the document contains 
<CODE>DOM_CDATASections</CODE>, 
         * the normalize operation alone may not be sufficient, since XPointers 
do 
         * not differentiate between <CODE>DOM_Text</CODE>
         * nodes and <CODE>DOM_CDATASection</CODE> nodes.</P>
         */
        virtual void
        normalize();
  
        /**
         * Tests whether the DOM implementation implements a specific
         * feature and that feature is supported by this node.
         * @param feature The string of the feature to test. This is the same
         * name as what can be passed to the method <code>hasFeature</code> on
         * <code>DOMImplementation</code>.
         * @param version This is the version number of the feature to test. In
         * Level 2, version 1, this is the string "2.0". If the version is not
         * specified, supporting any version of the feature will cause the
         * method to return <code>true</code>.
         * @return Returns <code>true</code> if the specified feature is 
supported
         * on this node, <code>false</code> otherwise.
         */
        virtual bool
        supports(
                        const XalanDOMString&   feature,
                        const XalanDOMString&   version) const;
  
        /**
         * Get the <em>namespace URI</em> of
         * this node, or <code>null</code> if it is unspecified.
         * <p>
         * This is not a computed value that is the result of a namespace lookup
         * based on an examination of the namespace declarations in scope. It is
         * merely the namespace URI given at creation time.
         * <p>
         * For nodes of any type other than <CODE>ELEMENT_NODE</CODE> and 
         * <CODE>ATTRIBUTE_NODE</CODE> and nodes created with a DOM Level 1 
method, 
         * such as <CODE>createElement</CODE> from the <CODE>Document</CODE>
         * interface, this is always <CODE>null</CODE>.
         */
        virtual const XalanDOMString&
        getNamespaceURI() const;
  
        /**
         * Get the <em>namespace prefix</em>
         * of this node, or <code>null</code> if it is unspecified.
         */
        virtual const XalanDOMString&
        getPrefix() const;
  
        /**
         * Returns the local part of the <em>qualified name</em> of this node.
         * <p>
         * For nodes created with a DOM Level 1 method, such as
         * <code>createElement</code> from the <code>DOM_Document</code> 
interface,
         * it is null.
         */
        virtual const XalanDOMString&
        getLocalName() const;
  
        /**
         * Set the <em>namespace prefix</em> of this node.
         * <p>
         * Note that setting this attribute, when permitted, changes 
         * the <CODE>nodeName</CODE> attribute, which holds the <EM>qualified 
         * name</EM>, as well as the <CODE>tagName</CODE> and <CODE>name</CODE> 
         * attributes of the <CODE>DOM_Element</CODE> and <CODE>DOM_Attr</CODE>
         * interfaces, when applicable.
         * <p>
         * Note also that changing the prefix of an 
         * attribute, that is known to have a default value, does not make a 
new 
         * attribute with the default value and the original prefix appear, 
since the 
         * <CODE>namespaceURI</CODE> and <CODE>localName</CODE> do not change.
         *
         * @param prefix The prefix of this node.
         * @exception DOMException
         *       INVALID_CHARACTER_ERR: Raised if the specified prefix contains
         *                                                      an illegal 
character.
         * <br>
         *       NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         * <br>
         *       NAMESPACE_ERR: Raised if the specified <CODE>prefix</CODE> is 
         *               malformed, if the specified prefix is "xml" and the 
         *               <CODE>namespaceURI</CODE> of this node is different 
from 
         *               "http://www.w3.org/XML/1998/namespace";, if specified 
prefix is 
         *               "xmlns" and the <CODE>namespaceURI</CODE> is neither 
         *               <CODE>null</CODE> nor an empty string, or if the 
         *               <CODE>localName</CODE> is <CODE>null</CODE>.
         */
        virtual void
        setPrefix(const XalanDOMString&         prefix);
  
        virtual bool
        isIndexed() const;
  
        virtual unsigned long
        getIndex() const;
  
        //@}
  
        // These interfaces are inherited from XalanCDATASection...
  
        /** @name Getter functions. */
        //@{
        /**
         * Returns the character data of the node that implements this 
interface. 
         *
         * The DOM implementation may not put arbitrary limits on the amount of 
data that 
         * may be stored in a  <code>CharacterData</code> node. However, 
         * implementation limits may  mean that the entirety of a node's data 
may 
         * not fit into a single <code>DOMString</code>. In such cases, the 
user 
         * may call <code>substringData</code> to retrieve the data in 
         * appropriately sized pieces.
         * @exception DOMException
         *       NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
         * @exception DOMException
         *       DOMSTRING_SIZE_ERR: Raised when it would return more 
characters than 
         *       fit in a <code>DOMString</code> variable on the implementation 
         *       platform.
         */
        virtual const XalanDOMString&
        getData() const;
  
        /**
         * Returns the number of characters that are available through 
<code>data</code> and 
         * the <code>substringData</code> method below. 
         *
         * This may have the value 
         * zero, i.e., <code>CharacterData</code> nodes may be empty.
         */
        virtual unsigned int
        getLength() const;
  
        /**
         * Extracts a range of data from the node.
         *
         * @param offset Start offset of substring to extract.
         * @param count The number of characters to extract.
         * @return The specified substring. If the sum of <code>offset</code> 
and 
         *       <code>count</code> exceeds the <code>length</code>, then all 
         *       characters to the end of the data are returned.
         * @exception DOMException
         *       INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
         *       than the number of characters in <code>data</code>, or if the 
         *       specified <code>count</code> is negative.
         *       <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text 
does not 
         *       fit into a <code>DOMString</code>.
         */
        virtual XalanDOMString
        substringData(
                        unsigned int    offset, 
                        unsigned int    count) const;
  
        //@}
        /** @name Functions that set or change data. */
        //@{
        /**
         * Append the string to the end of the character data of the node.
         *
         * Upon success, <code>data</code> provides access to the concatenation 
of 
         * <code>data</code> and the <code>DOMString</code> specified.
         * @param arg The <code>DOMString</code> to append.
         * @exception DOMException
         *       NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
         */
        virtual void
        appendData(const XalanDOMString&        arg);
  
        /**
         * Insert a string at the specified character offset.
         *
         * @param offset The character offset at which to insert.
         * @param arg The <code>DOMString</code> to insert.
         * @exception DOMException
         *       INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
         *       than the number of characters in <code>data</code>.
         *       <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is 
readonly.
         */
        virtual void
        insertData(
                        unsigned int                    offset,
                        const  XalanDOMString&  arg);
  
        /**
         * Remove a range of characters from the node. 
         *
         * Upon success, 
         * <code>data</code> and <code>length</code> reflect the change.
         * @param offset The offset from which to remove characters.
         * @param count The number of characters to delete. If the sum of 
         *       <code>offset</code> and <code>count</code> exceeds 
<code>length</code> 
         *       then all characters from <code>offset</code> to the end of the 
data 
         *       are deleted.
         * @exception DOMException
         *       INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
         *       than the number of characters in <code>data</code>, or if the 
         *       specified <code>count</code> is negative.
         *       <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is 
readonly.
         */
        virtual void
        deleteData(
                        unsigned int    offset, 
                        unsigned int    count);
  
        /**
         * Replace the characters starting at the specified character offset 
with 
         * the specified string.
         *
         * @param offset The offset from which to start replacing.
         * @param count The number of characters to replace. If the sum of 
         *       <code>offset</code> and <code>count</code> exceeds 
<code>length</code>
         *       , then all characters to the end of the data are replaced 
(i.e., the 
         *       effect is the same as a <code>remove</code> method call with 
the same 
         *       range, followed by an <code>append</code> method invocation).
         * @param arg The <code>DOMString</code> with which the range must be 
         *       replaced.
         * @exception DOMException
         *       INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
         *       than the number of characters in <code>data</code>, or if the 
         *       specified <code>count</code> is negative.
         *       <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is 
readonly.
         */
        virtual void
        replaceData(
                        unsigned int                    offset, 
                        unsigned int                    count, 
                        const XalanDOMString&   arg);
  
    //@}
  
      //@}
      /** @name Functions to modify the Text node. */
      //@{
  
      /**
       * Breaks this node into two nodes at the specified 
       * offset, keeping both in the tree as siblings. 
       *
       * This node then only 
       * contains all the content up to the <code>offset</code> point. And a 
new 
       * node of the same nodeType, which is inserted as the next sibling of 
this 
       * node, contains all the content at and after the <code>offset</code> 
       * point. When the <code>offset</code> is equal to the lenght of this 
node,
       * the new node has no data.
       * @param offset The offset at which to split, starting from 0.
       * @return The new <code>Text</code> node.
       * @exception DOMException
       *   INDEX_SIZE_ERR: Raised if the specified offset is negative or 
greater 
       *   than the number of characters in <code>data</code>.
       *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
       */
      virtual XalanText*
        splitText(unsigned int  offset);
  
      //@}
  
        virtual bool
        isIgnorableWhitespace() const;
  
  
        // public interfaces not inherited from XalanCDATASection...
  
        XalanSourceTreeElement*
        getParentElement() const
        {
                return m_parentElement;
        }
  
        void
        setParentElement(XalanSourceTreeElement*        theParentElement)
        {
                m_parentElement = theParentElement;
        }
  
        void
        setPreviousSibling(XalanSourceTreeComment*      thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeCDATASection*         
thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeElement*      thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeProcessingInstruction*        
thePreviousSibling);
  
        void
        setPreviousSibling(XalanSourceTreeText*         thePreviousSibling);
  
        void
        appendSiblingNode(XalanSourceTreeComment*       theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeCDATASection*  theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeElement*       theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeProcessingInstruction*         
theSibling);
  
        void
        appendSiblingNode(XalanSourceTreeText*  theSibling);
  
        void
        setIndex(unsigned int   theIndex)
        {
                m_index = theIndex;
        }
  
  protected:
  
        XalanSourceTreeText(
                        const XalanSourceTreeText&      theSource,
                        bool                                            /* deep 
*/);
  
  private:
  
        // Not implemented...
        XalanSourceTreeText&
        operator=(const XalanSourceTreeText&    theSource);
  
        bool
        operator==(const XalanSourceTreeText&   theRHS) const;
  
  
        // Data members...
        const XalanDOMString&                   m_data;
  
        XalanSourceTreeElement*                 m_parentElement;
  
        XalanNode*                                              
m_previousSibling;
  
        XalanNode*                                              m_nextSibling;
  
        unsigned int                                    m_index;
  
        static const XalanDOMString&    s_nameString;
  };
  
  
  
  #endif        // !defined(XALANSOURCETREETEXT_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeTextAllocator.cpp
  
  Index: XalanSourceTreeTextAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanSourceTreeTextAllocator.hpp"
  
  
  
  XalanSourceTreeTextAllocator::XalanSourceTreeTextAllocator(size_type  
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanSourceTreeTextAllocator::~XalanSourceTreeTextAllocator()
  {
  }
  
  
  
  XalanSourceTreeTextAllocator::ObjectType*
  XalanSourceTreeTextAllocator::create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex)
  {
        ObjectType* const       theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        new(theBlock) ObjectType(
                                                theData,
                                                theParentElement,
                                                thePreviousSibling,
                                                theNextSibling,
                                                theIndex);
  
        m_allocator.commitAllocation(theBlock);
  
        return theBlock;
  }
  
  
  
  void 
  XalanSourceTreeTextAllocator::reset()
  {
        m_allocator.reset();
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeTextAllocator.hpp
  
  Index: XalanSourceTreeTextAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREETEXTALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANSOURCETREETEXTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeText.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeTextAllocator
  {
  public:
  
        typedef XalanSourceTreeText                                             
ObjectType;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<ObjectType>                                  
ArenaBlockType;
  
        typedef ArenaAllocator<ObjectType,
                                                   ArenaBlockType>              
        ArenaAllocatorType;
  #else
        typedef ArenaAllocator<ObjectType>                              
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type                   size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanSourceTreeTextAllocator(size_type  theBlockCount);
  
        ~XalanSourceTreeTextAllocator();
  
        /**
         * Create an instance.
         * 
         * @param theData The data for the node
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The next sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        ObjectType*
        create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        /**
         * Delete all objects from allocator.    
         */     
        void
        reset();
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanSourceTreeTextAllocator(const XalanSourceTreeTextAllocator&);
  
        XalanSourceTreeTextAllocator&
        operator=(const XalanSourceTreeTextAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANSOURCETREETEXTALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeTextIWS.cpp
  
  Index: XalanSourceTreeTextIWS.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #include "XalanSourceTreeTextIWS.hpp"
  
  
  
  XalanSourceTreeTextIWS::XalanSourceTreeTextIWS(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex) :
        XalanSourceTreeText(theData, theParentElement, thePreviousSibling, 
theNextSibling, theIndex)
  {
  }
  
  
  
  XalanSourceTreeTextIWS::~XalanSourceTreeTextIWS()
  {
  }
  
  
  
  XalanSourceTreeTextIWS::XalanSourceTreeTextIWS(
                        const XalanSourceTreeTextIWS&   theSource,
                        bool                                                    
/* deep */) :
        XalanSourceTreeText(theSource)
  {
  }
  
  
  
  bool
  XalanSourceTreeTextIWS::isIgnorableWhitespace() const
  {
        return true;
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeTextIWS.hpp
  
  Index: XalanSourceTreeTextIWS.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  #if !defined(XALANSOURCETREETEXTIWS_HEADER_GUARD_1357924680)
  #define XALANSOURCETREETEXTIWS_HEADER_GUARD_1357924680
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeText.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeTextIWS : public 
XalanSourceTreeText
  {
  public:
  
        /**
         * Constructor.
         *
         * @param theData The text data of the node
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The previous sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         */
        XalanSourceTreeTextIWS(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        virtual
        ~XalanSourceTreeTextIWS();
  
  
        virtual bool
        isIgnorableWhitespace() const;
  
  protected:
  
        XalanSourceTreeTextIWS(
                        const XalanSourceTreeTextIWS&   theSource,
                        bool                                                    
/* deep */);
  
  private:
  
        // Not implemented...
        XalanSourceTreeTextIWS&
        operator=(const XalanSourceTreeTextIWS&         theSource);
  
        bool
        operator==(const XalanSourceTreeTextIWS&        theRHS) const;
  
  
        // Data members...
  };
  
  
  
  #endif        // !defined(XALANSOURCETREETEXTIWS_HEADER_GUARD_1357924680)
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeTextIWSAllocator.cpp
  
  Index: XalanSourceTreeTextIWSAllocator.cpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  // Class header file.
  #include "XalanSourceTreeTextIWSAllocator.hpp"
  
  
  
  XalanSourceTreeTextIWSAllocator::XalanSourceTreeTextIWSAllocator(size_type    
theBlockCount) :
        m_allocator(theBlockCount)
  {
  }
  
  
  
  XalanSourceTreeTextIWSAllocator::~XalanSourceTreeTextIWSAllocator()
  {
  }
  
  
  
  XalanSourceTreeTextIWSAllocator::ObjectType*
  XalanSourceTreeTextIWSAllocator::create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement,
                        XalanNode*                                      
thePreviousSibling,
                        XalanNode*                                      
theNextSibling,
                        unsigned int                            theIndex)
  {
        ObjectType* const       theBlock = m_allocator.allocateBlock();
        assert(theBlock != 0);
  
        new(theBlock) ObjectType(
                                                theData,
                                                theParentElement,
                                                thePreviousSibling,
                                                theNextSibling,
                                                theIndex);
  
        m_allocator.commitAllocation(theBlock);
  
        return theBlock;
  }
  
  
  
  void
  XalanSourceTreeTextIWSAllocator::reset()
  {
        m_allocator.reset();
  }
  
  
  
  1.1                  
xml-xalan/c/src/XalanSourceTree/XalanSourceTreeTextIWSAllocator.hpp
  
  Index: XalanSourceTreeTextIWSAllocator.hpp
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xalan" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.ibm.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #if !defined(XALANSOURCETREETEXTIWSALLOCATOR_INCLUDE_GUARD_12455133)
  #define XALANSOURCETREETEXTIWSALLOCATOR_INCLUDE_GUARD_12455133
  
  
  
  #include <XalanSourceTree/XalanSourceTreeDefinitions.hpp>
  
  
  
  #include <PlatformSupport/ArenaAllocator.hpp>
  
  
  
  #include <XalanSourceTree/XalanSourceTreeTextIWS.hpp>
  
  
  
  class XALAN_XALANSOURCETREE_EXPORT XalanSourceTreeTextIWSAllocator
  {
  public:
  
        typedef XalanSourceTreeTextIWS                                  
ObjectType;
  
  #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
        typedef ArenaBlock<ObjectType>                                  
ArenaBlockType;
  
        typedef ArenaAllocator<ObjectType,
                                                   ArenaBlockType>              
        ArenaAllocatorType;
  #else
        typedef ArenaAllocator<ObjectType>                              
ArenaAllocatorType;
  #endif
  
        typedef ArenaAllocatorType::size_type                   size_type;
  
        /**
         * Construct an instance that will allocate blocks of the specified 
size.
         *
         * @param theBlockSize The block size.
         */
        XalanSourceTreeTextIWSAllocator(size_type       theBlockCount);
  
        ~XalanSourceTreeTextIWSAllocator();
  
        /**
         * Create an instance.
         * 
         * @param theData The data for the node
         * @param theParentElement The parent element, if any.
         * @param thePreviousSibling The next sibling, if any.
         * @param theNextSibling The next sibling, if any.
         * @param theIndex The document-order index of the node.
         *
         * @return pointer to the instance
         */
        ObjectType*
        create(
                        const XalanDOMString&           theData,
                        XalanSourceTreeElement*         theParentElement = 0,
                        XalanNode*                                      
thePreviousSibling = 0,
                        XalanNode*                                      
theNextSibling = 0,
                        unsigned int                            theIndex = 0);
  
        /**
         * Delete all objects from allocator.    
         */     
        void
        reset();
  
        /**
         * Get size of an ArenaBlock, that is, the number
         * of objects in each block.
         *
         * @return The size of the block
         */
        size_type
        getBlockCount() const
        {
                return m_allocator.getBlockCount();
        }
  
        /**
         * Get the number of ArenaBlocks currently allocated.
         *
         * @return The number of blocks.
         */
        size_type
        getBlockSize() const
        {
                return m_allocator.getBlockSize();
        }
  
  private:
  
        // Not implemented...
        XalanSourceTreeTextIWSAllocator(const XalanSourceTreeTextIWSAllocator&);
  
        XalanSourceTreeTextIWSAllocator&
        operator=(const XalanSourceTreeTextIWSAllocator&);
  
        // Data members...
        ArenaAllocatorType      m_allocator;
  };
  
  
  
  #endif        // XALANSOURCETREETEXTIWSALLOCATOR_INCLUDE_GUARD_12455133
  
  
  

Reply via email to