sboag       00/10/30 10:44:12

  Modified:    java/src/org/apache/xalan/stree AttrImpl.java
                        AttrImplNS.java CDATASectionImpl.java Child.java
                        CommentImpl.java DOMImplementationImpl.java
                        DocumentFragmentImpl.java DocumentImpl.java
                        DocumentTypeImpl.java ElementImpl.java
                        ElementImplWithNS.java IndexedDocImpl.java
                        IndexedElem.java IndexedElemImpl.java
                        IndexedElemWithNS.java IndexedLocPathIterator.java
                        IndexedUnionPathIterator.java
                        LevelIndexIterator.java LevelIndexer.java
                        NameSpaceDecl.java NotationImpl.java Parent.java
                        ProcessingInstructionImpl.java
                        SourceTreeHandler.java StreeDOMBuilder.java
                        StreeDOMHelper.java TextImpl.java WhiteSpace.java
  Added:       java/src/org/apache/xalan/stree SaxEventDispatch.java
  Log:
  In addition to JIndent formatting:
  
  Many fine-grained optimizations.
  
  Change the Stree DOM to use linked references to first child and next and 
previous siblings, instead of arrays for child lists.  This follows much more 
naturally the way they are being accessed by the iterators, though perhaps at 
some expense for space.
  
  The DocumentImpl node now holds a single character array for text.  Text 
nodes copy into that array, instead of each making a String object as soon as 
they are created.  A string is created upon demand.  With some transformations, 
this could actually mean more space taken, rather than less, though I think the 
net will be a gain for most transformations.  In the long run, the real 
solution is to be able to use the original array, and not make a copy at all.  
We'll be working with the Xerces folks on this, and maybe try to push this onto 
the SAX standard.  Having to make a copy of the character data is a real nasty 
issue with the SAX spec.   And why-o-why doesn't Sun define a String object 
that can reference a character array, instead of having to copy?
  
  Stree character nodes now implement a SaxEventDispatch interface.  Xalan asks 
the node if it implements this interface via the .supports method, and then 
calls dispatchSaxEvent(ContentHandler ch), allowing the text node to directly 
dispatch to the characters event, directly passing in the data from the 
character array in the DocumentImpl.
  
  Revision  Changes    Path
  1.4       +226 -84   xml-xalan/java/src/org/apache/xalan/stree/AttrImpl.java
  
  Index: AttrImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/AttrImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AttrImpl.java     2000/10/09 23:25:15     1.3
  +++ AttrImpl.java     2000/10/30 18:43:43     1.4
  @@ -1,151 +1,293 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.Attr;
   import org.w3c.dom.Element;
  +
   import org.xml.sax.Attributes;
  +
   import org.w3c.dom.DOMException;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class AttrImpl <needs-comment/>
  + */
   public class AttrImpl extends Child implements Attr
   {
  +
  +  /** NEEDSDOC Field m_name          */
     private String m_name;
  +
  +  /** NEEDSDOC Field m_value          */
     private String m_value;
  +
  +  /** NEEDSDOC Field m_specified          */
     private boolean m_specified = true;
  -  
  +
  +  /**
  +   * Constructor AttrImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param value
  +   */
     AttrImpl(DocumentImpl doc, String name, String value)
     {
  +
       super(doc);
  +
       m_name = name;
       m_value = value;
     }
  -  
  +
     /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() 
  +  public short getNodeType()
     {
       return Node.ATTRIBUTE_NODE;
     }
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return m_name;
     }
  -  
  +
     /**
  -   * The namespace URI of this node, or <code>null</code> if it is 
  +   * The namespace URI of this node, or <code>null</code> if it is
      * unspecified.
  -   * <br>This is not a computed value that is the result of a namespace 
  -   * lookup based on an examination of the namespace declarations in scope. 
  +   * <br>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.
  -   * <br>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>.Per 
  -   * the Namespaces in XML Specification  an attribute does not inherit its 
  -   * namespace from the element it is attached to. If an attribute is not 
  +   * <br>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>.Per
  +   * the Namespaces in XML Specification  an attribute does not inherit its
  +   * namespace from the element it is attached to. If an attribute is not
      * explicitly given a namespace, it simply has no namespace.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getNamespaceURI()
  +  public String getNamespaceURI()
     {
       return null;
  -  }
    
  +  }
  +
     /**
  -   * The namespace prefix of this node, or <code>null</code> if it is 
  +   * The namespace prefix of this node, or <code>null</code> if it is
      * unspecified.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getPrefix()
  {
    return null;
  +  public String getPrefix()
  +  {
  +    return null;
     }
  -
  /**
  +
  +  /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return m_name;
     }
  -  
  +
     /**
      * Returns the value of this attribute node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String getValue ()
  -  {      
  +  public String getValue()
  +  {
       return m_value;
  -  } 
  -  
  -  /** Same as getValue(). */
  -  public String getNodeValue()
  -    throws DOMException
  +  }
  +
  +  /**
  +   * Same as getValue(). 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public String getNodeValue() throws DOMException
     {
       return m_value;
     }
  -  
  +
     /**
      * Sets the value of this attribute node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC @param value
  +   *
  +   * @throws DOMException
      */
  -  public void setValue (String value) throws DOMException
  -  {      
  +  public void setValue(String value) throws DOMException
  +  {
       m_value = value;
  +  }
  +
  +  /**
  +   *    If this attribute was explicitly given a value in the original
  +   *   document, this is <code>true</code> ; otherwise, it is
  +   *   <code>false</code> . Note that the implementation is in charge of this
  +   *   attribute, not the user. If the user changes the value of the
  +   *   attribute (even if it ends up having the same value as the default
  +   *   value) then the <code>specified</code> flag is automatically flipped
  +   *   to <code>true</code> .  To re-specify the attribute as the default
  +   *   value from the DTD, the user must delete the attribute. The
  +   *   implementation will then make a new attribute available with
  +   *   <code>specified</code> set to <code>false</code> and the default value
  +   *   (if one exists).
  +   *   <br> In summary: If the attribute has an assigned value in the 
document
  +   *   then  <code>specified</code> is <code>true</code> , and the value is
  +   *   the  assigned value. If the attribute has no assigned value in the
  +   *   document and has  a default value in the DTD, then
  +   *   <code>specified</code> is <code>false</code> ,  and the value is the
  +   *   default value in the DTD. If the attribute has no assigned value in
  +   *   the document and has  a value of #IMPLIED in the DTD, then the
  +   *   attribute does not appear  in the structure model of the document.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public boolean getSpecified()
  +  {
  +    return m_specified;
  +  }
  +
  +  /**
  +   *   The <code>Element</code> node this attribute is attached to or
  +   *  <code>null</code> if this attribute is not in use.
  +   *  @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Element getOwnerElement()
  +  {
  +    return (Element) getParentNode();
  +  }
  +
  +  /**
  +   * NEEDSDOC Method getName 
  +   *
  +   *
  +   * NEEDSDOC (getName) @return
  +   */
  +  public String getName()
  +  {
  +    return m_name;
  +  }
  +
  +  /**
  +   * NEEDSDOC Method setName 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   */
  +  void setName(String name)
  +  {
  +    m_name = name;
     }
  -  
  +
     /**
  -     *  If this attribute was explicitly given a value in the original 
  -     * document, this is <code>true</code> ; otherwise, it is 
  -     * <code>false</code> . Note that the implementation is in charge of 
this 
  -     * attribute, not the user. If the user changes the value of the 
  -     * attribute (even if it ends up having the same value as the default 
  -     * value) then the <code>specified</code> flag is automatically flipped 
  -     * to <code>true</code> .  To re-specify the attribute as the default 
  -     * value from the DTD, the user must delete the attribute. The 
  -     * implementation will then make a new attribute available with 
  -     * <code>specified</code> set to <code>false</code> and the default 
value 
  -     * (if one exists).
  -     * <br> In summary: If the attribute has an assigned value in the 
document 
  -     * then  <code>specified</code> is <code>true</code> , and the value is 
  -     * the  assigned value. If the attribute has no assigned value in the 
  -     * document and has  a default value in the DTD, then 
  -     * <code>specified</code> is <code>false</code> ,  and the value is the 
  -     * default value in the DTD. If the attribute has no assigned value in 
  -     * the document and has  a value of #IMPLIED in the DTD, then the  
  -     * attribute does not appear  in the structure model of the document.
  -     */
  -    public boolean getSpecified()
  -    {
  -      return m_specified;
  -    }
  -    
  -   /**
  -     *  The <code>Element</code> node this attribute is attached to or 
  -     * <code>null</code> if this attribute is not in use.
  -     * @since DOM Level 2
  -     */
  -    public Element getOwnerElement()
  -    {
  -      return (Element)getParentNode();
  -    }
  -    
  -    public String getName()
  -    {
  -      return m_name;
  -    }  
  -    
  -    void setName(String name)
  -    {
  -      m_name = name;
  -    }  
  -    
  +   * The node immediately preceding this node. If there is no such node,
  +   * this returns <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node getPreviousSibling()
  +  {
  +    return null;
  +  }
  +
  +  /**
  +   * The node immediately following this node. If there is no such node,
  +   * this returns <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node getNextSibling()
  +  {
  +    return m_parent.m_first;
  +  }
   }
  
  
  
  1.5       +113 -27   xml-xalan/java/src/org/apache/xalan/stree/AttrImplNS.java
  
  Index: AttrImplNS.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/AttrImplNS.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AttrImplNS.java   2000/10/09 23:25:16     1.4
  +++ AttrImplNS.java   2000/10/30 18:43:43     1.5
  @@ -1,65 +1,151 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
  +
   import org.xml.sax.Attributes;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class AttrImplNS <needs-comment/>
  + */
   public class AttrImplNS extends AttrImpl
   {
  +
  +  /** NEEDSDOC Field m_localName          */
     private String m_localName;
  -  private String m_namespaceURI;                  // attribute index
  -  
  +
  +  /** NEEDSDOC Field m_namespaceURI          */
  +  private String m_namespaceURI;  // attribute index
  +
  +  /**
  +   * Constructor AttrImplNS
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param uri
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param value
  +   */
     AttrImplNS(DocumentImpl doc, String uri, String name, String value)
     {
  +
       super(doc, name, value);
  +
       // System.out.println("AttrImplNS - name: "+name);
       // System.out.println("uri: "+uri+", "+name);
       m_namespaceURI = uri;
  +
       int index = name.indexOf(':');
  -    if (index >0)
  -      m_localName = name.substring(index+1);
  +
  +    if (index > 0)
  +      m_localName = name.substring(index + 1);
       else
         m_localName = name;
     }
  -  
  -  
  -  
  +
     /**
  -   * The namespace URI of this node, or <code>null</code> if it is 
  +   * The namespace URI of this node, or <code>null</code> if it is
      * unspecified.
  -   * <br>This is not a computed value that is the result of a namespace 
  -   * lookup based on an examination of the namespace declarations in scope. 
  +   * <br>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.
  -   * <br>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>.Per 
  -   * the Namespaces in XML Specification  an attribute does not inherit its 
  -   * namespace from the element it is attached to. If an attribute is not 
  +   * <br>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>.Per
  +   * the Namespaces in XML Specification  an attribute does not inherit its
  +   * namespace from the element it is attached to. If an attribute is not
      * explicitly given a namespace, it simply has no namespace.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getNamespaceURI()
  +  public String getNamespaceURI()
     {
  -    return m_namespaceURI;    
  -  }
    
  +    return m_namespaceURI;
  +  }
  +
     /**
  -   * The namespace prefix of this node, or <code>null</code> if it is 
  +   * The namespace prefix of this node, or <code>null</code> if it is
      * unspecified.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getPrefix()
  {
  +  public String getPrefix()
  +  {
  +
       String m_name = getNodeName();
       int indexOfNSSep = m_name.indexOf(':');
  -    return (indexOfNSSep >= 0) 
  -                    ? m_name.substring(0, indexOfNSSep) : null;
  +
  +    return (indexOfNSSep >= 0) ? m_name.substring(0, indexOfNSSep) : null;
     }
  -
  /**
  +
  +  /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return m_localName;
     }
  
  
  
  1.4       +126 -10   
xml-xalan/java/src/org/apache/xalan/stree/CDATASectionImpl.java
  
  Index: CDATASectionImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/CDATASectionImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CDATASectionImpl.java     2000/10/09 23:25:16     1.3
  +++ CDATASectionImpl.java     2000/10/30 18:43:44     1.4
  @@ -1,41 +1,157 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.CDATASection;
   
  +import org.xml.sax.ContentHandler;
  +import org.xml.sax.SAXException;
  +import org.xml.sax.ext.LexicalHandler;
  +
  +import org.apache.xalan.utils.FastStringBuffer;
  +
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class CDATASectionImpl <needs-comment/>
  + */
   public class CDATASectionImpl extends TextImpl implements CDATASection
   {
  -  public CDATASectionImpl (DocumentImpl doc, String data)
  +
  +  /**
  +   * Constructor CDATASectionImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param data
  +   */
  +  public CDATASectionImpl(DocumentImpl doc, String data)
     {
       super(doc, data);
     }
   
  -  public CDATASectionImpl (DocumentImpl doc, char ch[], int start, int 
length)
  +  /**
  +   * Constructor CDATASectionImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   */
  +  public CDATASectionImpl(DocumentImpl doc, char ch[], int start, int length)
     {
       super(doc, ch, start, length);
     }
   
  -  /** Returns the node type. */
  -  public short getNodeType() 
  +  /**
  +   * Returns the node type. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public short getNodeType()
     {
       return Node.CDATA_SECTION_NODE;
     }
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return "#cdata-section";
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return "#cdata-section";
  +  }
  +
  +  /**
  +   * NEEDSDOC Method dispatchSaxEvent 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   *
  +   * @throws SAXException
  +   */
  +  public void dispatchSaxEvent(ContentHandler ch) throws SAXException
  +  {
  +
  +    LexicalHandler lh = ((LexicalHandler) ch);
  +
  +    lh.startCDATA();
  +
  +    if (-1 == m_start)
  +      ch.characters(m_data.toCharArray(), 0, m_data.length());
  +    else
  +      ch.characters(m_doc.m_chars.m_map, m_start, m_length);
  +
  +    lh.endCDATA();
     }
   }
  
  
  
  1.10      +287 -150  xml-xalan/java/src/org/apache/xalan/stree/Child.java
  
  Index: Child.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/Child.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Child.java        2000/10/17 18:50:47     1.9
  +++ Child.java        2000/10/30 18:43:44     1.10
  @@ -1,3 +1,59 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.apache.xalan.utils.UnImplNode;
  @@ -12,298 +68,379 @@
   // There will be a better way...
   import org.apache.xalan.transformer.TransformerImpl;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Child <needs-comment/>
  + */
   public class Child extends UnImplNode implements DOMOrder
   {
  -  private Parent m_parent;
  -  private short m_level;
  -  private DocumentImpl m_doc;
  -  protected void setDoc(DocumentImpl doc){m_doc = doc;}
  -  
  +
  +  /** NEEDSDOC Field m_doc          */
  +  protected DocumentImpl m_doc;
  +
  +  /** NEEDSDOC Field m_parent          */
  +  protected Parent m_parent;
  +
  +  /** NEEDSDOC Field m_next          */
  +  Child m_next;
  +
  +  /** NEEDSDOC Field m_prev          */
  +  Child m_prev;
  +
  +  /** NEEDSDOC Field m_level          */
  +  short m_level;
  +
  +  /** NEEDSDOC Field m_uid          */
  +  int m_uid;
  +
  +  /**
  +   * NEEDSDOC Method setDoc 
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   */
  +  protected void setDoc(DocumentImpl doc)
  +  {
  +    m_doc = doc;
  +  }
  +
  +  /**
  +   * Constructor Child
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   */
     public Child(DocumentImpl doc)
     {
       m_doc = doc;
     }
  -  
  +
     /**
      * Set the parent of the node.
  +   *
  +   * NEEDSDOC @param parent
      */
     protected void setParent(Parent parent)
     {
       m_parent = parent;
     }
  -  
  +
     /**
  -   * Return if this node has had all it's children added, i.e. 
  -   * if a endElement event has occured.  An atomic node always 
  +   * Return if this node has had all it's children added, i.e.
  +   * if a endElement event has occured.  An atomic node always
      * returns true.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isComplete()
     {
  +
       // Atomic nodes are always complete.
       return true;
     }
  -  
  +
  +  /**
  +   * Set that this node's child list is complete, i.e.
  +   * an endElement event has occured.
  +   *
  +   * NEEDSDOC @param isComplete
  +   */
  +  public void setComplete(boolean isComplete){}
  +
  +  /**
  +   * NEEDSDOC Method getTransformer 
  +   *
  +   *
  +   * NEEDSDOC (getTransformer) @return
  +   */
     protected TransformerImpl getTransformer()
     {
  -    return this.getDocumentImpl().getSourceTreeHandler().getTransformer();
  +    return m_doc.m_sourceTreeHandler.m_transformer;
     }
  -  
  +
     /**
  -   * Get an object that is being synchronized 
  -   * with the parse thread, so that notification 
  -   * will work correctly.
  +   * NEEDSDOC Method throwParseError 
  +   *
  +   *
  +   * NEEDSDOC @param e
      */
  -  protected Object getSynchObject()
  -  {
  -    return this.getDocumentImpl().getSourceTreeHandler().getSynchObject();
  -  }
  -  
     protected void throwParseError(Exception e)
     {
       throw new org.apache.xalan.utils.WrappedRuntimeException(e);
     }
  -    
  -  protected void throwIfParseError()
  -  {
  -    TransformerImpl ti = getTransformer();
  -    
  -    if(null != ti)
  -    {
  -      Exception e = ti.getExceptionThrown();
  -      if(null != e)
  -        throwParseError(e);
  -    }
  -  }
  -  
  -  
  -  /**
  -   * The position in the parent's list.
  -   */
  -  private int m_childPos;
  -  
  -  /**
  -   * <meta name="usage" content="internal"/>
  -   * Set the position of the child of an element in the parent 
  -   * array.
  -   */
  -  protected void SetChildPosition(int pos)
  -  {
  -    m_childPos = (short)pos;
  -  }
  -  
  +
     /**
  -   * <meta name="usage" content="internal"/>
  -   * Get the position of the child of an element in the parent 
  -   * array.
  +   * NEEDSDOC Method throwIfParseError 
  +   *
      */
  -  public int getChildPosition()
  +  protected void throwIfParseError()
     {
  -    return m_childPos;
  +    if (null != m_doc.m_exceptionThrown)
  +      throwParseError(m_doc.m_exceptionThrown);
     }
  -  
  -  /**
  -   * The UID (document order index).
  -   */
  -  private int m_uid;
  -  
  +
     /**
      * Set the UID (document order index).
  +   *
  +   * NEEDSDOC @param kIndex
      */
     protected void setUid(int kIndex)
     {
       m_uid = kIndex;
     }
  -  
  +
     /**
      * Get the UID (document order index).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getUid()
     {
       return m_uid;
     }
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Get the depth level of this node in the tree.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getLevel()
     {
       return m_level;
     }
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Get the depth level of this node in the tree.
  +   *
  +   * NEEDSDOC @param level
      */
     public void setLevel(short level)
     {
       m_level = level;
     }
  -  
  +
     /**
      * Get the root Document Implementation.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     DocumentImpl getDocumentImpl()
     {
       return m_doc;
     }
   
  -  
     // ================ Node interface implementation ==============
  -        
  +
     /**
  -   * The parent of this node. All nodes, except <code>Attr</code>, 
  -   * <code>Document</code>, <code>DocumentFragment</code>, 
  -   * <code>Entity</code>, and <code>Notation</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, this is 
  +   * The parent of this node. All nodes, except <code>Attr</code>,
  +   * <code>Document</code>, <code>DocumentFragment</code>,
  +   * <code>Entity</code>, and <code>Notation</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, this is
      * <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node         getParentNode()
  {
  +  public Node getParentNode()
  +  {
  +
       // if(null != m_parent)
       //  m_parent.waitForHaveParent();
  -    return this.m_parent;
  }
  +    return this.m_parent;
  +  }
   
     /**
  -   * The first child of this node. If there is no such node, this returns 
  +   * The first child of this node. If there is no such node, this returns
      * <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node         getFirstChild()
  -  {
    return null;
  -  }
  
  +  public Node getFirstChild()
  +  {
  +    return null;
  +  }
  +
     /**
  -   * The last child of this node. If there is no such node, this returns 
  +   * The last child of this node. If there is no such node, this returns
      * <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node         getLastChild()
  -  {
    return null;
  -  }
  
  +  public Node getLastChild()
  +  {
  +    return null;
  +  }
  +
     /**
  -   * The node immediately preceding this node. If there is no such node, 
  +   * The node immediately preceding this node. If there is no such node,
      * this returns <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node         getPreviousSibling()
  +  public Node getPreviousSibling()
     {
  -    if (m_parent!= null)
  -    {
  -      try{
        return m_parent.getChild(getChildPosition()-1);
  -      }
  -      catch(Exception e)
  -      {
  -        throw new org.apache.xalan.utils.WrappedRuntimeException(e);
  -      }
  -    }  
  -    return null;
  -  }
  
  +    return m_prev;
  +  }
  +
     /**
  -   * The node immediately following this node. If there is no such node, 
  +   * The node immediately following this node. If there is no such node,
      * this returns <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node         getNextSibling()
  +  public Node getNextSibling()
     {
  -    if (m_parent!= null)
  +
  +    if (null != m_next)
  +      return m_next;
  +    else if (!m_parent.m_isComplete)
       {
  -      try
  -      {
  -        return m_parent.getChild(getChildPosition()+1);
  -      }
  -      catch(Exception e)
  +      synchronized (m_doc)
         {
  -        throw new org.apache.xalan.utils.WrappedRuntimeException(e);
  +        try
  +        {
  +
  +          // System.out.println("Waiting... getChild " + i + " " + 
getNodeName());
  +          while (!m_parent.isComplete())
  +          {
  +            m_doc.wait();
  +            throwIfParseError();
  +
  +            if (null != m_next)
  +              return m_next;
  +          }
  +        }
  +        catch (InterruptedException e)
  +        {
  +          throwIfParseError();
  +        }
         }
  -    }  
  -    return null;
  +    }
  +
  +    return m_next;
     }
  -      
  +
     /**
  -   * The <code>Document</code> object associated with this node. This is 
  -   * also the <code>Document</code> object used to create new nodes. When 
  -   * this node is a <code>Document</code> or a <code>DocumentType</code> 
  -   * which is not used with any <code>Document</code> yet, this is 
  +   * The <code>Document</code> object associated with this node. This is
  +   * also the <code>Document</code> object used to create new nodes. When
  +   * this node is a <code>Document</code> or a <code>DocumentType</code>
  +   * which is not used with any <code>Document</code> yet, this is
      * <code>null</code>.
      * @version DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Document     getOwnerDocument()
  {
    return m_doc;
  -  }
  
  +  public Document getOwnerDocument()
  +  {
  +    return m_doc;
  +  }
  +
     /**
  -   *  This is a convenience method to allow easy determination of whether a 
  +   *  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, 
  +   * @return  <code>true</code> if the node has any children,
      *   <code>false</code> if the node has no children.
      */
  -  public boolean      hasChildNodes()
  {
  -    return false;
  }
  +  public boolean hasChildNodes()
  +  {
  +    return false;
  +  }
   
     /**
  -   * Tests whether the DOM implementation implements a specific feature and 
  +   * Tests whether the DOM implementation implements a specific feature and
      * that feature is supported by this node.
      * @since DOM Level 2
  -   * @param feature The string of the feature to test. This is the same name 
  -   *   that which can be passed to the method <code>hasFeature</code> on 
  +   * @param feature The string of the feature to test. This is the same name
  +   *   that which 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 
  +   * @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 
  +   * @return Returns <code>true</code> if the specified feature is supported
      *   on this node, <code>false</code> otherwise.
      */
  -  public boolean      supports(String feature, 
  -                               String version)
  {
  -    return false;
  }
  +  public boolean supports(String feature, String version)
  +  {
  +    return false;
  +  }
   
     /**
  -   * The namespace URI of this node, or <code>null</code> if it is 
  +   * The namespace URI of this node, or <code>null</code> if it is
      * unspecified.
  -    */
  -  public String       getNamespaceURI()
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNamespaceURI()
     {
       return null;
  -  }
    
  +  }
  +
     /**
  -   * The namespace prefix of this node, or <code>null</code> if it is 
  +   * The namespace prefix of this node, or <code>null</code> if it is
      * unspecified.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getPrefix()
  {
    return null;
  +  public String getPrefix()
  +  {
  +    return null;
     }
  -
  /**
  +
  +  /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return null;
     }
  -  
  -  /** UnImplemented. */
  +
  +  /**
  +   * UnImplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getTagName()
     {
       return null;
     }
  -  
  -  /** Unimplemented. */
  -  public NamedNodeMap       getAttributes()
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public NamedNodeMap getAttributes()
     {
       return null;
     }
  -  
  -  /** Unimplemented. */
  -  public void               setAttribute(String name,
  -                                         String value)
  -    throws DOMException
  -  {    
  -  }
  -  
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param value
  +   *
  +   * @throws DOMException
  +   */
  +  public void setAttribute(String name, String value) throws DOMException{}
  +
     /**
      * Tell if the given node is a namespace decl node.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isNamespaceNode()
     {
       return false;
     }
  -
   }
  
  
  
  1.4       +118 -10   
xml-xalan/java/src/org/apache/xalan/stree/CommentImpl.java
  
  Index: CommentImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/CommentImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CommentImpl.java  2000/10/09 23:25:16     1.3
  +++ CommentImpl.java  2000/10/30 18:43:44     1.4
  @@ -1,44 +1,152 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.Comment;
   
  +import org.xml.sax.ContentHandler;
  +import org.xml.sax.SAXException;
  +import org.xml.sax.ext.LexicalHandler;
  +
  +import org.apache.xalan.utils.FastStringBuffer;
  +
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class CommentImpl <needs-comment/>
  + */
   public class CommentImpl extends TextImpl implements Comment
   {
  -  public CommentImpl (DocumentImpl doc, String data)
  +
  +  /**
  +   * Constructor CommentImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param data
  +   */
  +  public CommentImpl(DocumentImpl doc, String data)
     {
       super(doc, data);
     }
   
  -  public CommentImpl (DocumentImpl doc, char ch[], int start, int length)
  +  /**
  +   * Constructor CommentImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   */
  +  public CommentImpl(DocumentImpl doc, char ch[], int start, int length)
     {
       super(doc, ch, start, length);
     }
   
  -  /** 
  +  /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() 
  +  public short getNodeType()
     {
       return Node.COMMENT_NODE;
     }
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return "#comment";
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return "#comment";
  +  }
  +
  +  /**
  +   * NEEDSDOC Method dispatchSaxEvent 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   *
  +   * @throws SAXException
  +   */
  +  public void dispatchSaxEvent(ContentHandler ch) throws SAXException
  +  {
  +
  +    if (-1 == m_start)
  +      ((LexicalHandler) ch).comment(m_data.toCharArray(), 0, 
m_data.length());
  +    else
  +      ((LexicalHandler) ch).comment(m_doc.m_chars.m_map, m_start, m_length);
     }
   }
  
  
  
  1.2       +109 -42   
xml-xalan/java/src/org/apache/xalan/stree/DOMImplementationImpl.java
  
  Index: DOMImplementationImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/DOMImplementationImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMImplementationImpl.java        2000/06/19 16:52:30     1.1
  +++ DOMImplementationImpl.java        2000/10/30 18:43:45     1.2
  @@ -1,17 +1,79 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Document;
   import org.w3c.dom.DocumentType;
   import org.w3c.dom.DOMImplementation;
   import org.w3c.dom.DOMException;
  +
   import org.apache.xalan.utils.UnImplNode;
   
  -public class DOMImplementationImpl extends UnImplNode implements 
DOMImplementation
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class DOMImplementationImpl <needs-comment/>
  + */
  +public class DOMImplementationImpl extends UnImplNode
  +        implements DOMImplementation
   {
  +
     //
     // Data
     //
  -
     // static
   
     /** Dom implementation singleton. */
  @@ -21,10 +83,10 @@
     // DOMImplementation methods
     //
   
  -  /** 
  +  /**
      * Test if the DOM implementation supports a specific "feature" --
      * currently meaning language and level thereof.
  -   * 
  +   *
      * @param feature      The package name of the feature to test.
      * In Level 1, supported values are "HTML" and "XML" (case-insensitive).
      * At this writing, org.apache.xerces.dom supports only XML.
  @@ -35,65 +97,67 @@
      *
      * @returns    true iff this implementation is compatable with the
      * specified feature and version.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean hasFeature(String feature, String version) {
  +  public boolean hasFeature(String feature, String version)
  +  {
   
       // Currently, we support only XML Level 1 version 1.0
  -    return 
  -      (feature.equalsIgnoreCase("XML") 
  -       && (version == null
  -           || version.equals("1.0")
  -           || version.equals("2.0")))
  -      || (feature.equalsIgnoreCase("Events") 
  -          && (version == null
  -              || version.equals("2.0")))
  -      || (feature.equalsIgnoreCase("MutationEvents") 
  -          && (version == null
  -              || version.equals("2.0")))
  -      || (feature.equalsIgnoreCase("Traversal") 
  -          && (version == null
  -              || version.equals("2.0")))
  -      ;
  -
  -  } // hasFeature(String,String):boolean
  +    return (feature.equalsIgnoreCase(
  +      "XML") && (version == null || version.equals("1.0") || version.equals(
  +      "2.0"))) || (feature.equalsIgnoreCase(
  +        "Events") && (version == null || version.equals(
  +        "2.0"))) || (feature.equalsIgnoreCase(
  +          "MutationEvents") && (version == null || version.equals(
  +          "2.0"))) || (feature.equalsIgnoreCase(
  +            "Traversal") && (version == null || version.equals("2.0")));
  +  }  // hasFeature(String,String):boolean
   
     //
     // Public methods
     //
   
  -  /** NON-DOM: Obtain and return the single shared object */
  -  public static DOMImplementation getDOMImplementation() {
  +  /**
  +   * NON-DOM: Obtain and return the single shared object 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public static DOMImplementation getDOMImplementation()
  +  {
       return singleton;
  -  }  
  -  
  +  }
  +
     /**
      * Introduced in DOM Level 2. <p>
  -   * 
  +   *
      * Creates an empty DocumentType node.
      *
  -   * @param qualifiedName The qualified name of the document type to be 
created. 
  +   * @param qualifiedName The qualified name of the document type to be 
created.
      * @param publicID The document type public identifier.
      * @param systemID The document type system identifier.
      * @since WD-DOM-Level-2-19990923
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public DocumentType       createDocumentType(String qualifiedName, 
  -                                               String publicID, 
  -                                               String systemID)
  +  public DocumentType createDocumentType(String qualifiedName,
  +                                         String publicID, String systemID)
     {
  +
       // return new DocumentTypeImpl(null, qualifiedName, publicID, systemID);
       return null;
     }
  -  
  +
     /**
      * Introduced in DOM Level 2. <p>
  -   * 
  +   *
      * Creates an XML Document object of the specified type with its document
      * element.
      *
      * @param namespaceURI     The namespace URI of the document
  -   *                         element to create, or null. 
  +   *                         element to create, or null.
      * @param qualifiedName    The qualified name of the document
  -   *                         element to create, or null. 
  +   *                         element to create, or null.
      * @param doctype          The type of document to be created or null.<p>
      *
      *                         When doctype is not null, its
  @@ -104,16 +168,19 @@
      *                         already been used with a different document.
      * @since WD-DOM-Level-2-19990923
      */
  -  public Document           createDocument(String namespaceURI, 
  -                                           String qualifiedName, 
  -                                           DocumentType doctype)
  -    throws DOMException
  +  public Document createDocument(
  +          String namespaceURI, String qualifiedName, DocumentType doctype)
  +            throws DOMException
     {
  -    if (doctype != null && doctype.getOwnerDocument() != null) {
  -      throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, 
  -        "DOM005 Wrong document");
  +
  +    if (doctype != null && doctype.getOwnerDocument() != null)
  +    {
  +      throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
  +                             "DOM005 Wrong document");
       }
  +
       DocumentImpl doc = new DocumentImpl(doctype);
  +
       return doc;
     }
   }
  
  
  
  1.5       +86 -10    
xml-xalan/java/src/org/apache/xalan/stree/DocumentFragmentImpl.java
  
  Index: DocumentFragmentImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/DocumentFragmentImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DocumentFragmentImpl.java 2000/10/09 23:25:16     1.4
  +++ DocumentFragmentImpl.java 2000/10/30 18:43:45     1.5
  @@ -1,39 +1,115 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.DocumentFragment;
   
  -public class DocumentFragmentImpl extends DocumentImpl implements 
DocumentFragment
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class DocumentFragmentImpl <needs-comment/>
  + */
  +public class DocumentFragmentImpl extends DocumentImpl
  +        implements DocumentFragment
   {
  +
  +  /**
  +   * Constructor DocumentFragmentImpl
  +   *
  +   */
     public DocumentFragmentImpl()
     {
  +
       super();
  +
       setComplete(true);
     }
  -  
  -  /** 
  +
  +  /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() 
  +  public short getNodeType()
     {
       return Node.DOCUMENT_FRAGMENT_NODE;
     }
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return "#document-fragment";
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return "#document-fragment";
     }
  
  
  
  1.9       +343 -123  
xml-xalan/java/src/org/apache/xalan/stree/DocumentImpl.java
  
  Index: DocumentImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/DocumentImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DocumentImpl.java 2000/10/09 23:25:16     1.8
  +++ DocumentImpl.java 2000/10/30 18:43:45     1.9
  @@ -1,3 +1,59 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.ProcessingInstruction;
  @@ -14,297 +70,461 @@
   
   import java.util.Hashtable;
   
  +import org.apache.xalan.utils.FastStringBuffer;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class DocumentImpl <needs-comment/>
  + */
   public class DocumentImpl extends Parent
   {
  +
  +  /** NEEDSDOC Field m_exceptionThrown          */
  +  public Exception m_exceptionThrown = null;
  +
  +  /** NEEDSDOC Field m_chars          */
  +  FastStringBuffer m_chars = new FastStringBuffer(1024 * 64);
  +
  +  /**
  +   * Constructor DocumentImpl
  +   *
  +   */
     DocumentImpl()
     {
  +
       super(null);
  +
       setDoc(this);
  -       m_bUpIndexer = new LevelIndexer();
  +
  +    // m_bUpIndexer = new LevelIndexer();
     }
   
  +  /**
  +   * Constructor DocumentImpl
  +   *
  +   *
  +   * NEEDSDOC @param sth
  +   */
     DocumentImpl(SourceTreeHandler sth)
     {
  +
       super(null);
  +
       setDoc(this);
  -       m_bUpIndexer = new LevelIndexer();
  +
  +    // m_bUpIndexer = new LevelIndexer();
       m_sourceTreeHandler = sth;
     }
   
  +  /**
  +   * Constructor DocumentImpl
  +   *
  +   *
  +   * NEEDSDOC @param doctype
  +   */
     DocumentImpl(DocumentType doctype)
     {
  +
       super(null);
  +
       setDoc(this);
  -    if(null != doctype)
  -      m_docType = (DocumentTypeImpl)doctype;
  -       m_bUpIndexer = new LevelIndexer();
  +
  +    if (null != doctype)
  +      m_docType = (DocumentTypeImpl) doctype;
  +
  +    // m_bUpIndexer = new LevelIndexer();
     }
  -  
  -  private SourceTreeHandler m_sourceTreeHandler;
  +
  +  /** NEEDSDOC Field m_sourceTreeHandler          */
  +  SourceTreeHandler m_sourceTreeHandler;
  +
  +  /**
  +   * NEEDSDOC Method getSourceTreeHandler 
  +   *
  +   *
  +   * NEEDSDOC (getSourceTreeHandler) @return
  +   */
     SourceTreeHandler getSourceTreeHandler()
     {
       return m_sourceTreeHandler;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setSourceTreeHandler 
  +   *
  +   *
  +   * NEEDSDOC @param h
  +   */
     void setSourceTreeHandler(SourceTreeHandler h)
     {
       m_sourceTreeHandler = h;
     }
  -  
  -  private boolean indexedLookup = false;   // for now
  -    
  +
  +  /** NEEDSDOC Field indexedLookup          */
  +  private boolean indexedLookup = false;  // for now
  +
     /**
  -   * 
  +   *
      */
  -  private LevelIndexer m_bUpIndexer ;
  - 
  +
  +  // private LevelIndexer m_bUpIndexer ;
  +
     /**
  -   * 
  +   *
      */
  -  public LevelIndexer getLevelIndexer()
  -  {
  -    return m_bUpIndexer;
  -  }
  -  
  +  // public LevelIndexer getLevelIndexer()
  +  // {
  +  //  return m_bUpIndexer;
  +  // }
     DocumentTypeImpl m_docType;
  -  
  -  private int m_docOrderCount = 1;
  +
  +  /** NEEDSDOC Field m_docOrderCount          */
  +  int m_docOrderCount = 1;
   
     /**
  -   * Increment the document order count.  Needs to be called 
  +   * Increment the document order count.  Needs to be called
      * when a child is added.
      */
     protected void incrementDocOrderCount()
     {
       m_docOrderCount++;
     }
  -  
  +
     /**
  -   * Increment the document order count.  Needs to be called 
  +   * Get the number of nodes in the tree.  Needs to be called
      * when a child is added.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getDocOrderCount()
     {
       return m_docOrderCount;
  -  }  
  +  }
   
     /**
      * For XML, this provides access to the Document Type Definition.
      * For HTML documents, and XML documents which don't specify a DTD,
      * it will be null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public DocumentType getDoctype() 
  +  public DocumentType getDoctype()
     {
       return m_docType;
     }
  -  
  -  private boolean m_useMultiThreading = false;
  -  
  +
  +  /** NEEDSDOC Field m_useMultiThreading          */
  +  boolean m_useMultiThreading = false;
  +
     /**
  -   * Set whether or not the tree being built should handle 
  +   * Set whether or not the tree being built should handle
      * transformation while the parse is still going on.
  +   *
  +   * NEEDSDOC @param b
      */
     public void setUseMultiThreading(boolean b)
     {
       m_useMultiThreading = b;
     }
  -  
  +
     /**
  -   * Tell whether or not the tree being built should handle 
  +   * Tell whether or not the tree being built should handle
      * transformation while the parse is still going on.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean getUseMultiThreading()
     {
       return m_useMultiThreading;
     }
  -  
  +
     /**
      * The document element.
      */
     ElementImpl m_docElement;
  -  
  +
     /**
      * Convenience method, allowing direct access to the child node
      * which is considered the root of the actual document content.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Element getDocumentElement() 
  +  public Element getDocumentElement()
     {
       return m_docElement;
     }
  -  
  +
  +  /** NEEDSDOC Field m_idAttributes          */
     Hashtable m_idAttributes = new Hashtable();
  -  
  +
  +  /**
  +   * NEEDSDOC Method getIDAttributes 
  +   *
  +   *
  +   * NEEDSDOC (getIDAttributes) @return
  +   */
     public Hashtable getIDAttributes()
     {
       return m_idAttributes;
  -  } 
  -  
  -  public void setIDAttribute(String namespaceURI,
  -                             String qualifiedName,
  -                             String value,
  -                             Element elem)
  +  }
  +
  +  /**
  +   * NEEDSDOC Method setIDAttribute 
  +   *
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   * NEEDSDOC @param value
  +   * NEEDSDOC @param elem
  +   */
  +  public void setIDAttribute(String namespaceURI, String qualifiedName,
  +                             String value, Element elem)
     {
       m_idAttributes.put(value, elem);
     }
  -  
  +
     /**
      * Append a child to the child list.
      * @param newChild Must be a org.apache.xalan.stree.Child.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception ClassCastException if the newChild isn't a 
org.apache.xalan.stree.Child.
  +   *
  +   * @throws DOMException
      */
  -  public Node appendChild(Node newChild)
  -    throws DOMException
  +  public Node appendChild(Node newChild) throws DOMException
     {
  -    int type = newChild.getNodeType();
  -    if (type == Node.ELEMENT_NODE) 
  +
  +    short type = newChild.getNodeType();
  +
  +    if (type == Node.ELEMENT_NODE)
       {
  -      if(null != m_docElement)
  +      if (null != m_docElement)
           throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
  -          "DOM006 Hierarchy request error");
  -      
  -      m_docElement = (ElementImpl)newChild;
  +                               "DOM006 Hierarchy request error");
  +
  +      m_docElement = (ElementImpl) newChild;
       }
  -    else if (type == Node.DOCUMENT_TYPE_NODE) 
  +    else if (type == Node.DOCUMENT_TYPE_NODE)
       {
  -      m_docType = (DocumentTypeImpl)newChild;
  +      m_docType = (DocumentTypeImpl) newChild;
       }
  +
       return super.appendChild(newChild);
     }
   
  -
  -  /** Returns the node type. */
  -  public short getNodeType() 
  +  /**
  +   * Returns the node type. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public short getNodeType()
     {
       return Node.DOCUMENT_NODE;
     }
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return "#document";
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return "#document";
     }
  -  
  -  /** Unimplemented. */
  -  public Element            createElement(String tagName)
  -    throws DOMException
  -  {
  -    if (indexedLookup)
  -      return new IndexedElemImpl(this, tagName);
  -    else
  -      return new ElementImpl(this, tagName);
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param tagName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Element createElement(String tagName) throws DOMException
  +  {
  +    return new ElementImpl(this, tagName);
     }
   
  -  /** Create a DocumentFragment. */
  -  public DocumentFragment   createDocumentFragment()
  +  /**
  +   * Create a DocumentFragment. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public DocumentFragment createDocumentFragment()
     {
       return new DocumentFragmentImpl();
     }
   
  -  /** Create a Text node. */
  -  public Text               createTextNode(String data)
  +  /**
  +   * Create a Text node. 
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Text createTextNode(String data)
     {
       return new TextImpl(this, data);
     }
   
  -  /** Create a Comment node. */
  -  public Comment            createComment(String data)
  +  /**
  +   * Create a Comment node. 
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Comment createComment(String data)
     {
       return new CommentImpl(this, data);
     }
  -
  -  /** Create a CDATASection node. */
  -  public CDATASection       createCDATASection(String data)
  -    throws DOMException
   
  +  /**
  +   * Create a CDATASection node. 
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public CDATASection createCDATASection(String data) throws DOMException
     {
       return new CDATASectionImpl(this, data);
     }
  -
  -  /** Create a ProcessingInstruction node. */
  -  public ProcessingInstruction createProcessingInstruction(String target,
  -                                                           String data)
  -    throws DOMException
   
  +  /**
  +   * Create a ProcessingInstruction node. 
  +   *
  +   * NEEDSDOC @param target
  +   * NEEDSDOC @param data
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public ProcessingInstruction createProcessingInstruction(
  +          String target, String data) throws DOMException
     {
       return new ProcessingInstructionImpl(this, target, data);
     }
   
  -  /** Unimplemented right now, but I should probably implement. */
  -  public Node               importNode(Node importedNode,
  -                                       boolean deep)
  -    throws DOMException
  +  /**
  +   * Unimplemented right now, but I should probably implement. 
  +   *
  +   * NEEDSDOC @param importedNode
  +   * NEEDSDOC @param deep
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node importNode(Node importedNode, boolean deep) throws DOMException
     {
       return super.importNode(importedNode, deep);
     }
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Element createElementNS(String namespaceURI, String qualifiedName)
  +          throws DOMException
  +  {
  +    return new ElementImplWithNS(this, namespaceURI, qualifiedName);
  +  }
   
  -  /** Unimplemented. */
  -  public Element            createElementNS(String namespaceURI,
  -                                            String qualifiedName)
  -    throws DOMException
  -  {
  -    if (indexedLookup)
  -      return new IndexedElemWithNS(this, namespaceURI, qualifiedName);
  -    else
  -      return new ElementImplWithNS(this, namespaceURI, qualifiedName);
  -    //return super.createElementNS(namespaceURI, qualifiedName);
  -  }
  -
  -  /** Unimplemented. */
  -  public Attr               createAttributeNS(String namespaceURI,
  -                                              String qualifiedName)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Attr createAttributeNS(String namespaceURI, String qualifiedName)
  +          throws DOMException
     {
       return super.createAttributeNS(namespaceURI, qualifiedName);
     }
  -  
  +
     /**
      * Given an ID, return the element.
  +   *
  +   * NEEDSDOC @param elementId
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Element getElementById(String elementId)
     {
  -    Element elem = (Element)m_idAttributes.get(elementId); 
  +
  +    Element elem = (Element) m_idAttributes.get(elementId);
  +
       // Make sure we're done parsing.
  -    if (elem == null && !isComplete())
  -    { 
  -      Object synchObj = getSynchObject();
  -      synchronized (synchObj)
  +    if (elem == null &&!isComplete())
  +    {
  +      synchronized (m_doc)
         {
           try
           {
  +
             // Don't really know why we should need the while loop,
             // but we seem to come out of wait() too soon! 
             while (!isComplete())
             {
  -            synchObj.wait();
  +            m_doc.wait();
               throwIfParseError();
  -            elem = (Element)m_idAttributes.get(elementId); 
  -            if(null != elem)
  +
  +            elem = (Element) m_idAttributes.get(elementId);
  +
  +            if (null != elem)
                 return elem;
             }
           }
           catch (InterruptedException e)
  -        {   
  +        {
             throwIfParseError();
  -        }        
  +        }
         }
  -      elem = (Element)m_idAttributes.get(elementId); 
  -    }    
  +
  +      elem = (Element) m_idAttributes.get(elementId);
  +    }
  +
       return elem;
     }
  -  
  -  
   
  +  /**
  +   * The node immediately following this node. If there is no such node,
  +   * this returns <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node getNextSibling()
  +  {
  +    return null;
  +  }
   }
  
  
  
  1.5       +178 -68   
xml-xalan/java/src/org/apache/xalan/stree/DocumentTypeImpl.java
  
  Index: DocumentTypeImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/DocumentTypeImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DocumentTypeImpl.java     2000/10/09 23:25:16     1.4
  +++ DocumentTypeImpl.java     2000/10/30 18:43:45     1.5
  @@ -1,106 +1,216 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.DocumentType;
   import org.w3c.dom.NamedNodeMap;
   
  -public class DocumentTypeImpl extends Child implements DocumentType 
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class DocumentTypeImpl <needs-comment/>
  + */
  +public class DocumentTypeImpl extends Child implements DocumentType
   {
  +
  +  /**
  +   * Constructor DocumentTypeImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param name
  +   */
     DocumentTypeImpl(DocumentImpl doc, String name)
     {
  +
       super(doc);
  +
       m_name = name;
     }
  -  
  +
  +  /** NEEDSDOC Field m_name          */
     private String m_name;
  +
  +  /** NEEDSDOC Field m_publicID          */
     private String m_publicID;
  +
  +  /** NEEDSDOC Field m_systemID          */
     private String m_systemID;
  +
  +  /** NEEDSDOC Field m_internalSubset          */
     private String m_internalSubset;
   
  -  
  -  /** 
  +  /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() 
  +  public short getNodeType()
     {
       return Node.DOCUMENT_TYPE_NODE;
     }
  -  
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
  -    return m_name; // I guess I need the name of the document type
  +    return m_name;  // I guess I need the name of the document type
     }
  -  
  +
     /**
  -   * The name of DTD; i.e., the name immediately following the 
  +   * The name of DTD; i.e., the name immediately following the
      * <code>DOCTYPE</code> keyword.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getName()
  {
  -    return m_name;
  }
  -  
  -   /**
  +  public String getName()
  +  {
  +    return m_name;
  +  }
  +
  +  /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return m_name;
     }
   
  -  
  -    /**
  -     * A <code>NamedNodeMap</code> containing the general entities, both 
  -     * external and internal, declared in the DTD. Parameter entities are 
not 
  -     *  contained. Duplicates are discarded. For example in:
  -     * <pre>
  -     * &lt;!DOCTYPE ex SYSTEM "ex.dtd" [
  -     *   &lt;!ENTITY foo "foo"&gt;
  -     *   &lt;!ENTITY bar "bar"&gt;
  -     *   &lt;!ENTITY bar "bar2"&gt;
  -     *   &lt;!ENTITY % baz "baz"&gt;
  -     * ]&gt;
  -     * &lt;ex/&gt;</pre>
  -     *   the interface 
  -     * provides access to <code>foo</code> and the first declaration of 
  -     * <code>bar</code> but not the second declaration of  <code>bar</code> 
  -     * or <code>baz</code>. Every node in this map also implements the 
  -     * <code>Entity</code> interface.
  -     * <br>The DOM Level 2 does not support editing entities, therefore 
  -     * <code>entities</code> cannot be altered in any way.
  -     */
  -    public NamedNodeMap getEntities()
    {
  -      return null;
    }
    
  -    /**
  -     * A <code>NamedNodeMap</code> containing  the notations declared in the 
  -     * DTD. Duplicates are discarded. Every node in this map also implements 
  -     * the <code>Notation</code> interface.
  -     * <br>The DOM Level 2 does not support editing notations, therefore 
  -     * <code>notations</code> cannot be altered in any way.
  -     */
  -    public NamedNodeMap getNotations()
    {
  -      return null;
    }
    
  -    /**
  -     * The public identifier of the external subset.
  -     * @since DOM Level 2
  -     */
  -    public String       getPublicId()
    {
  -      return m_publicID;
    }
    
  -    /**
  -     * The system identifier of the external subset.
  -     * @since DOM Level 2
  -     */
  -    public String       getSystemId()
    {
  -      return m_systemID;
    }
    
  -    /**
  -     * The internal subset as a string.
  -     * @since DOM Level 2
  -     */
  -    public String       getInternalSubset()
    {
  -      return m_internalSubset;
    }
  +  /**
  +   * A <code>NamedNodeMap</code> containing the general entities, both
  +   * external and internal, declared in the DTD. Parameter entities are not
  +   *  contained. Duplicates are discarded. For example in:
  +   * <pre>
  +   * &lt;!DOCTYPE ex SYSTEM "ex.dtd" [
  +   *   &lt;!ENTITY foo "foo"&gt;
  +   *   &lt;!ENTITY bar "bar"&gt;
  +   *   &lt;!ENTITY bar "bar2"&gt;
  +   *   &lt;!ENTITY % baz "baz"&gt;
  +   * ]&gt;
  +   * &lt;ex/&gt;</pre>
  +   *   the interface
  +   * provides access to <code>foo</code> and the first declaration of
  +   * <code>bar</code> but not the second declaration of  <code>bar</code>
  +   * or <code>baz</code>. Every node in this map also implements the
  +   * <code>Entity</code> interface.
  +   * <br>The DOM Level 2 does not support editing entities, therefore
  +   * <code>entities</code> cannot be altered in any way.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public NamedNodeMap getEntities()
  +  {
  +    return null;
  +  }
   
  +  /**
  +   * A <code>NamedNodeMap</code> containing  the notations declared in the
  +   * DTD. Duplicates are discarded. Every node in this map also implements
  +   * the <code>Notation</code> interface.
  +   * <br>The DOM Level 2 does not support editing notations, therefore
  +   * <code>notations</code> cannot be altered in any way.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public NamedNodeMap getNotations()
  +  {
  +    return null;
  +  }
  +
  +  /**
  +   * The public identifier of the external subset.
  +   * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getPublicId()
  +  {
  +    return m_publicID;
  +  }
  +
  +  /**
  +   * The system identifier of the external subset.
  +   * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getSystemId()
  +  {
  +    return m_systemID;
  +  }
  +
  +  /**
  +   * The internal subset as a string.
  +   * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getInternalSubset()
  +  {
  +    return m_internalSubset;
  +  }
   }
  
  
  
  1.17      +775 -515  
xml-xalan/java/src/org/apache/xalan/stree/ElementImpl.java
  
  Index: ElementImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/ElementImpl.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ElementImpl.java  2000/10/17 18:51:46     1.16
  +++ ElementImpl.java  2000/10/30 18:43:48     1.17
  @@ -1,121 +1,229 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.apache.xalan.utils.QName;
   
   import org.w3c.dom.Node;
  +
   import org.xml.sax.Attributes;
  +
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Attr;
   import org.w3c.dom.DOMException;
  -
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class ElementImpl <needs-comment/>
  + */
   public class ElementImpl extends Parent implements Attributes, NamedNodeMap
  -  
   {
  +
  +  /** NEEDSDOC Field m_name          */
     private String m_name;
  -  private short attrsEnd = 0;
  -  
  -  ElementImpl (DocumentImpl doc, String name)
  +
  +  /** NEEDSDOC Field m_attrsEnd          */
  +  private short m_attrsEnd = 0;
  +
  +  /** NEEDSDOC Field m_firstAttr          */
  +  private AttrImpl m_firstAttr;
  +
  +  /** NEEDSDOC Field m_lastAttr          */
  +  private AttrImpl m_lastAttr;
  +
  +  /**
  +   * Constructor ElementImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param name
  +   */
  +  ElementImpl(DocumentImpl doc, String name)
     {
  +
       super(doc);
  -    m_name = name;    
  +
  +    m_name = name;
     }
   
  -  ElementImpl (DocumentImpl doc, String name, Attributes atts)
  +  /**
  +   * Constructor ElementImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param atts
  +   */
  +  ElementImpl(DocumentImpl doc, String name, Attributes atts)
     {
  +
       super(doc);
  +
       m_name = name;
  +
       setAttributes(atts);
     }
   
  -  /** 
  +  /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() {
  +  public short getNodeType()
  +  {
       return Node.ELEMENT_NODE;
     }
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return m_name;
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return m_name;
     }
  -  
  +
     /**
      * Returns the tag name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getTagName()
     {
       return m_name;
  -  }
  -  
  -  /**
  -   * The first child of this node. If there is no such node, this returns
  -   * Factor in any existing attribute nodes. 
  -   * <code>null</code>.
  -   */
  -  public Node         getFirstChild()
  -  {
  -    return hasChildNodes() ? getChild(attrsEnd) : null;
     }
  -      
  +
     /**
      * Get the nth attribute child.
      * @param i the index of the child.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception ArrayIndexOutOfBoundsException if the index is out of bounds.
      * @exception NullPointerException if there are no children.
      */
     public AttrImpl getChildAttribute(int i)
  -    throws ArrayIndexOutOfBoundsException, NullPointerException
  +          throws ArrayIndexOutOfBoundsException, NullPointerException
     {
  -    Object synchObj = getSynchObject();
  -    synchronized (synchObj)
  +
  +    synchronized (m_doc)
       {
  -      if (i < getAttrCount() && i >= 0) 
  -        return (AttrImpl)m_children[i];
  +      if (null != m_firstAttr)
  +      {
  +        Child next = m_firstAttr;
  +
  +        for (int k = 0; k < i; k++)
  +        {
  +          if (null == next)
  +            return null;
  +
  +          next = next.m_next;
  +        }
  +
  +        return (AttrImpl) next;
  +      }
         else
           return null;
       }
     }
  -  
  +
     /**
      * Get the number of children this node currently contains.
      * Factor in the number of attributes at beginning of list.
  -   * Note that this will only return the number of children 
  -   * added so far.  If the isComplete property is false, 
  +   * Note that this will only return the number of children
  +   * added so far.  If the isComplete property is false,
      * it is likely that more children will be added.
      * DON'T CALL THIS FUNCTION IF YOU CAN HELP IT!!!!!!
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getChildCount()
     {
  +
       if (!isComplete())
       {
  -      Object synchObj = getSynchObject();
  -      synchronized (synchObj)
  +      synchronized (m_doc)
         {
           try
           {
  +
             // Here we have to wait until the element is complete
             while (!isComplete())
             {
  -            synchObj.wait();
  +            m_doc.wait();
               throwIfParseError();
             }
           }
  @@ -123,572 +231,724 @@
           {
             throwIfParseError();
           }
  +
           //System.out.println("/// gotelcount " );
  -        
         }
       }
  -    return (null == m_children) ? 0 : m_children.length - getAttrCount();
  +
  +    return m_childCount;
     }
  -  
  -  
  +
     /**
      * Get attributes of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public NamedNodeMap       getAttributes()
  +  public NamedNodeMap getAttributes()
     {
       return this;
     }
  -  
  +
     /**
      * Set attributes of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param value
  +   *
  +   * @throws DOMException
      */
  -  public void               setAttribute(String name,
  -                                         String value)
  -    throws DOMException
  -  {
  -    AttrImpl attr = (AttrImpl)createAttribute(name); 
  -    attr.setValue(value); 
  -    
  +  public void setAttribute(String name, String value) throws DOMException
  +  {
  +
  +    AttrImpl attr = (AttrImpl) createAttribute(name);
  +
  +    attr.setValue(value);
     }
  -  
  +
     /**
      * Set attributes of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  -   */  
  -  public void               setAttributeNS(String namespaceURI,
  -                                           String qualifiedName,
  -                                           String value)
  -    throws DOMException
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   * NEEDSDOC @param value
  +   *
  +   * @throws DOMException
  +   */
  +  public void setAttributeNS(
  +          String namespaceURI, String qualifiedName, String value)
  +            throws DOMException
     {
  -    AttrImplNS attr = (AttrImplNS)createAttributeNS(namespaceURI, 
qualifiedName);
  +
  +    AttrImplNS attr = (AttrImplNS) createAttributeNS(namespaceURI,
  +                        qualifiedName);
  +
       attr.setValue(value);
  -    
     }
  -  
  +
     /**
      * Set a list of attributes of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  -   */ 
  -  public void               setAttributes(Attributes atts)
  -    throws DOMException
  +   *
  +   * NEEDSDOC @param atts
  +   *
  +   * @throws DOMException
  +   */
  +  public void setAttributes(Attributes atts) throws DOMException
     {
  -    for(int i=0; i< atts.getLength(); i++)
  +
  +    for (int i = 0; i < atts.getLength(); i++)
       {
         String uri = atts.getURI(i);
         String name = atts.getQName(i);
         AttrImpl attr;
  -      if (null != uri || name.indexOf(':') >0)
  -        attr = (AttrImplNS)createAttributeNS(uri, name);
  -      else        
  -        attr = (AttrImpl)createAttribute(name); 
  -      
  -      attr.setValue(atts.getValue(i));             
  -    } 
  -    
  -  }
  -  
  -  public void setIDAttribute(String namespaceURI,
  -                                           String qualifiedName,
  -                                           String value)
  +
  +      if (null != uri || name.indexOf(':') > 0)
  +        attr = (AttrImplNS) createAttributeNS(uri, name);
  +      else
  +        attr = (AttrImpl) createAttribute(name);
  +
  +      attr.setValue(atts.getValue(i));
  +    }
  +  }
  +
  +  /**
  +   * NEEDSDOC Method setIDAttribute 
  +   *
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   * NEEDSDOC @param value
  +   */
  +  public void setIDAttribute(String namespaceURI, String qualifiedName,
  +                             String value)
     {
  -    getDocumentImpl().setIDAttribute(namespaceURI, qualifiedName, value, 
this);
  +    getDocumentImpl().setIDAttribute(namespaceURI, qualifiedName, value,
  +                                     this);
     }
  -  
  +
     /**
  -   *  Create an attribute node. 
  +   *  Create an attribute node.
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
      */
  -  public Attr               createAttribute(String name)
  -    throws DOMException
  +  public Attr createAttribute(String name) throws DOMException
     {
  +
       // System.out.println("name: "+name);
       AttrImpl attrImpl;
  -    if(QName.isXMLNSDecl(name))
  +
  +    if (QName.isXMLNSDecl(name))
       {
         attrImpl = new NameSpaceDecl(getDocumentImpl(),
  -                                   "http://www.w3.org/2000/xmlns/";, 
  -                                   name, "");
  +                                   "http://www.w3.org/2000/xmlns/";, name, 
"");
       }
       else
         attrImpl = new AttrImpl(getDocumentImpl(), name, "");
  +
       boolean found = false;
  -    for (int i = 0; i < attrsEnd; i++)
  +    AttrImpl attr = m_firstAttr;
  +
  +    while (null != attr)
       {
  -      AttrImpl attr = (AttrImpl)m_children[i];
         if (attr.getNodeName().equals(name))
  -      {  
  -        m_children[i] = attrImpl;
  +      {
  +        if (null != attr.m_prev)
  +          attr.m_prev.m_next = attr.m_next;
  +
  +        if (null != m_next)
  +          attr.m_next.m_prev = attr.m_prev;
  +
  +        attr.m_next = null;
  +        attr.m_prev = null;
           found = true;
  +
           break;
         }
  -    } 
  +
  +      attr = (AttrImpl) attr.m_next;
  +    }
  +
       if (!found)
  -    {          
  -      appendChild(attrImpl);
  -      attrsEnd++;
  -      
  -    }       
  -    return (Attr)attrImpl;    
  -  }
  -  
  -  /** 
  -   * Create an attribute node with a namespace . 
  -   */
  -  public Attr               createAttributeNS(String namespaceURI,
  -                                              String qualifiedName)
  -    throws DOMException
  +    {
  +      if (null == m_firstAttr)
  +      {
  +        m_firstAttr = attrImpl;
  +      }
  +      else
  +      {
  +        m_lastAttr.m_next = attrImpl;
  +        attrImpl.m_prev = m_lastAttr;
  +      }
  +
  +      m_lastAttr = attrImpl;
  +
  +      m_doc.incrementDocOrderCount();
  +      attrImpl.setUid(m_doc.getDocOrderCount());
  +      attrImpl.setParent(this);
  +      attrImpl.setLevel((short) (getLevel() + 1));
  +
  +      m_attrsEnd++;
  +    }
  +
  +    return (Attr) attrImpl;
  +  }
  +
  +  /**
  +   * Create an attribute node with a namespace .
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Attr createAttributeNS(String namespaceURI, String qualifiedName)
  +          throws DOMException
     {
  +
       // System.out.println("qualifiedName: "+qualifiedName);
  -    AttrImplNS attrImpl = new AttrImplNS(getDocumentImpl(), 
  -                                         namespaceURI, 
  +    AttrImplNS attrImpl = new AttrImplNS(getDocumentImpl(), namespaceURI,
                                            qualifiedName, "");
       boolean found = false;
  -    for (int i = 0; i < attrsEnd; i++)
  +    AttrImpl attr = m_firstAttr;
  +
  +    while (null != attr)
       {
  -      AttrImpl attr = (AttrImpl)m_children[i];
  -      if (attr.getLocalName().equals(attrImpl.getLocalName()) &&
  -            attr.getNamespaceURI().equals(attrImpl.getNamespaceURI()))
  -      {  
  -        m_children[i] = attrImpl;
  +      if (attr.getLocalName().equals(attrImpl.getLocalName())
  +              && attr.getNamespaceURI().equals(attrImpl.getNamespaceURI()))
  +      {
  +        if (null != attr.m_prev)
  +          attr.m_prev.m_next = attr.m_next;
  +
  +        if (null != m_next)
  +          attr.m_next.m_prev = attr.m_prev;
  +
  +        attr.m_next = null;
  +        attr.m_prev = null;
           found = true;
  +
           break;
         }
  -    } 
  +
  +      attr = (AttrImpl) attr.m_next;
  +    }
  +
       if (!found)
  -    {          
  -      appendChild(attrImpl);
  -      attrsEnd++;      
  -    } 
  -    return (Attr)attrImpl;    
  +    {
  +      if (null == m_firstAttr)
  +      {
  +        m_firstAttr = attrImpl;
  +      }
  +      else
  +      {
  +        m_lastAttr.m_next = attrImpl;
  +        attrImpl.m_prev = m_lastAttr;
  +      }
  +
  +      m_lastAttr = attrImpl;
  +
  +      m_doc.incrementDocOrderCount();
  +      attrImpl.setUid(m_doc.getDocOrderCount());
  +      attrImpl.setParent(this);
  +      attrImpl.setLevel((short) (getLevel() + 1));
  +
  +      m_attrsEnd++;
  +    }
  +
  +    return (Attr) attrImpl;
     }
  -  
  +
     //
     //implement Attributes Interface
     //
  -  
  -    /**
  -     * Return the number of attributes in the list.
  -     *
  -     * @return The number of attributes in the list.
  -     */
  -  public int getAttrCount ()
  -  {
  -    return attrsEnd;
  -  }
  -      
  -
  -
  -    /**
  -     * Look up an attribute's Namespace URI by index.
  -     *
  -     * @param index The attribute index (zero-based).
  -     * @return The Namespace URI, or the empty string if none
  -     *         is available, or null if the index is out of
  -     *         range.
  -     */
  -    public String getURI (int index)
  -    {
  -      AttrImpl attr = getChildAttribute(index);
  -      if (null != attr)
  -        return attr.getNamespaceURI();
  -      else
  -        return null;
  -    }
   
  +  /**
  +   * Return the number of attributes in the list.
  +   *
  +   * @return The number of attributes in the list.
  +   */
  +  public int getAttrCount()
  +  {
  +    return m_attrsEnd;
  +  }
  +
  +  /**
  +   * Look up an attribute's Namespace URI by index.
  +   *
  +   * @param index The attribute index (zero-based).
  +   * @return The Namespace URI, or the empty string if none
  +   *         is available, or null if the index is out of
  +   *         range.
  +   */
  +  public String getURI(int index)
  +  {
   
  -    /**
  -     * Look up an attribute's local name by index.
  -     *
  -     * @param index The attribute index (zero-based).
  -     * @return The local name, or the empty string if Namespace
  -     *         processing is not being performed, or null
  -     *         if the index is out of range.
  -     */
  -    public  String getLocalName (int index)
  -    {
  -      AttrImpl attr = getChildAttribute(index);
  -      if (null != attr)
  -        return attr.getLocalName();
  -      else
  -        return null;
  -    }  
  +    AttrImpl attr = getChildAttribute(index);
   
  +    if (null != attr)
  +      return attr.getNamespaceURI();
  +    else
  +      return null;
  +  }
   
  -    /**
  -     * Look up an attribute's raw XML 1.0 name by index.
  -     *
  -     * @param index The attribute index (zero-based).
  -     * @return The raw XML 1.0 name, or the empty string
  -     *         if none is available, or null if the index
  -     *         is out of range.
  -     */
  -    public String getQName (int index)
  -    {
  -      AttrImpl attr = getChildAttribute(index);
  -      if (null != attr)
  -        return attr.getNodeName();
  -      else
  -        return null;
  -    }  
  +  /**
  +   * Look up an attribute's local name by index.
  +   *
  +   * @param index The attribute index (zero-based).
  +   * @return The local name, or the empty string if Namespace
  +   *         processing is not being performed, or null
  +   *         if the index is out of range.
  +   */
  +  public String getLocalName(int index)
  +  {
   
  +    AttrImpl attr = getChildAttribute(index);
   
  -    /**
  -     * Look up an attribute's type by index.
  -     *
  -     * @param index The attribute index (zero-based).
  -     * @return The attribute's type as a string, or null if the
  -     *         index is out of range.
  -     */
  -    public String getType (int index)
  -    {
  -      AttrImpl attr = getChildAttribute(index);
  -      if (null != attr)
  -        return Integer.toString(attr.getNodeType());
  -      else
  -        return null;
  -    } 
  +    if (null != attr)
  +      return attr.getLocalName();
  +    else
  +      return null;
  +  }
   
  -    /**
  -     * Look up an attribute's value by index.
  -     *
  -     * @param index The attribute index (zero-based).
  -     * @return The attribute's value as a string, or null if the
  -     *         index is out of range.
  -     */
  -    public String getValue (int index)
  -    {
  -      AttrImpl attr = getChildAttribute(index);
  -      if (null != attr)
  -        return attr.getValue();
  -      else 
  -        return null;
  -    }
  -    
  -    /**
  -     * Look up an attribute's value by name.
  -     *
  -     * @param index The attribute index (zero-based).
  -     * @return The attribute's value as a string, or null if the
  -     *         index is out of range.
  -     */
  -  public String             getAttribute(String name)
  +  /**
  +   * Look up an attribute's raw XML 1.0 name by index.
  +   *
  +   * @param index The attribute index (zero-based).
  +   * @return The raw XML 1.0 name, or the empty string
  +   *         if none is available, or null if the index
  +   *         is out of range.
  +   */
  +  public String getQName(int index)
  +  {
  +
  +    AttrImpl attr = getChildAttribute(index);
  +
  +    if (null != attr)
  +      return attr.getNodeName();
  +    else
  +      return null;
  +  }
  +
  +  /**
  +   * Look up an attribute's type by index.
  +   *
  +   * @param index The attribute index (zero-based).
  +   * @return The attribute's type as a string, or null if the
  +   *         index is out of range.
  +   */
  +  public String getType(int index)
  +  {
  +
  +    AttrImpl attr = getChildAttribute(index);
  +
  +    if (null != attr)
  +      return Integer.toString(attr.getNodeType());
  +    else
  +      return null;
  +  }
  +
  +  /**
  +   * Look up an attribute's value by index.
  +   *
  +   * @param index The attribute index (zero-based).
  +   * @return The attribute's value as a string, or null if the
  +   *         index is out of range.
  +   */
  +  public String getValue(int index)
     {
  +
  +    AttrImpl attr = getChildAttribute(index);
  +
  +    if (null != attr)
  +      return attr.getValue();
  +    else
  +      return null;
  +  }
  +
  +  /**
  +   * Look up an attribute's value by name.
  +   *
  +   * @param index The attribute index (zero-based).
  +   *
  +   * NEEDSDOC @param name
  +   * @return The attribute's value as a string, or null if the
  +   *         index is out of range.
  +   */
  +  public String getAttribute(String name)
  +  {
       return getValue(name);
     }
   
  +  ////////////////////////////////////////////////////////////////////
  +  // Name-based query.
  +  ////////////////////////////////////////////////////////////////////
   
  -    ////////////////////////////////////////////////////////////////////
  -    // Name-based query.
  -    ////////////////////////////////////////////////////////////////////
  -
  -
  -    /**
  -     * Look up the index of an attribute by Namespace name.
  -     *
  -     * @param uri The Namespace URI, or the empty string if
  -     *        the name has no Namespace URI.
  -     * @param localName The attribute's local name.
  -     * @return The index of the attribute, or -1 if it does not
  -     *         appear in the list.
  -     */
  -    public int getIndex (String uri, String localPart)
  +  /**
  +   * Look up the index of an attribute by Namespace name.
  +   *
  +   * @param uri The Namespace URI, or the empty string if
  +   *        the name has no Namespace URI.
  +   * @param localName The attribute's local name.
  +   * NEEDSDOC @param localPart
  +   * @return The index of the attribute, or -1 if it does not
  +   *         appear in the list.
  +   */
  +  public int getIndex(String uri, String localPart)
  +  {
  +
  +    for (int i = 0; i < getAttrCount(); i++)
       {
  -      for (int i = 0; i < getAttrCount(); i++)
  -      {
  -        AttrImpl attr = (AttrImpl)getChildAttribute(i);
  -        if (attr.getLocalName().equals(localPart) &&
  -            attr.getNamespaceURI().equals(uri))
  -          return i;
  -      }
  -      return -1;
  -    } 
  +      AttrImpl attr = (AttrImpl) getChildAttribute(i);
   
  -    /**
  -     * Look up the index of an attribute by raw XML 1.0 name.
  -     *
  -     * @param rawName The raw (prefixed) name.
  -     * @return The index of the attribute, or -1 if it does not
  -     *         appear in the list.
  -     */
  -    public int getIndex (String rawName)
  +      if (attr.getLocalName().equals(localPart)
  +              && attr.getNamespaceURI().equals(uri))
  +        return i;
  +    }
  +
  +    return -1;
  +  }
  +
  +  /**
  +   * Look up the index of an attribute by raw XML 1.0 name.
  +   *
  +   * @param rawName The raw (prefixed) name.
  +   * @return The index of the attribute, or -1 if it does not
  +   *         appear in the list.
  +   */
  +  public int getIndex(String rawName)
  +  {
  +
  +    for (int i = 0; i < getAttrCount(); i++)
       {
  -      for (int i = 0; i < getAttrCount(); i++)
  -      {
  -        AttrImpl attr = getChildAttribute(i);
  -        if (attr.getNodeName().equals(rawName))
  -          return i;
  -      }
  -      return -1;
  -    }  
  +      AttrImpl attr = getChildAttribute(i);
  +
  +      if (attr.getNodeName().equals(rawName))
  +        return i;
  +    }
  +
  +    return -1;
  +  }
   
  -    /**
  -     * Look up an attribute's type by Namespace name.
  -     *
  -     * @param uri The Namespace URI, or the empty String if the
  -     *        name has no Namespace URI.
  -     * @param localName The local name of the attribute.
  -     * @return The attribute type as a string, or null if the
  -     *         attribute is not in the list or if Namespace
  -     *         processing is not being performed.
  -     */
  -    public String getType (String uri, String localName)
  +  /**
  +   * Look up an attribute's type by Namespace name.
  +   *
  +   * @param uri The Namespace URI, or the empty String if the
  +   *        name has no Namespace URI.
  +   * @param localName The local name of the attribute.
  +   * @return The attribute type as a string, or null if the
  +   *         attribute is not in the list or if Namespace
  +   *         processing is not being performed.
  +   */
  +  public String getType(String uri, String localName)
  +  {
  +
  +    for (int i = 0; i < getAttrCount(); i++)
       {
  -      for (int i = 0; i < getAttrCount(); i++)
  -      {
  -        AttrImpl attr = (AttrImpl)getChildAttribute(i);
  -        if (attr.getLocalName().equals(localName) &&
  -            attr.getNamespaceURI().equals(uri))
  -          return Integer.toString(attr.getNodeType());
  -      }
  -      return null;
  -    } 
  +      AttrImpl attr = (AttrImpl) getChildAttribute(i);
  +
  +      if (attr.getLocalName().equals(localName)
  +              && attr.getNamespaceURI().equals(uri))
  +        return Integer.toString(attr.getNodeType());
  +    }
   
  -    /**
  -     * Look up an attribute's type by raw XML 1.0 name.
  -     *
  -     * @param rawName The raw XML 1.0 name.
  -     * @return The attribute type as a string, or null if the
  -     *         attribute is not in the list or if raw names
  -     *         are not available.
  -     */
  -    public String getType (String rawName)
  +    return null;
  +  }
  +
  +  /**
  +   * Look up an attribute's type by raw XML 1.0 name.
  +   *
  +   * @param rawName The raw XML 1.0 name.
  +   * @return The attribute type as a string, or null if the
  +   *         attribute is not in the list or if raw names
  +   *         are not available.
  +   */
  +  public String getType(String rawName)
  +  {
  +
  +    for (int i = 0; i < getAttrCount(); i++)
       {
  -      for (int i = 0; i < getAttrCount(); i++)
  -      {
  -        AttrImpl attr = getChildAttribute(i);
  -        if (attr.getNodeName().equals(rawName))
  -          return Integer.toString(attr.getNodeType());
  -      }
  -      return null;
  -    } 
  +      AttrImpl attr = getChildAttribute(i);
   
  -    /**
  -     * Look up an attribute's value by Namespace name.
  -     *
  -     * @param uri The Namespace URI, or the empty String if the
  -     *        name has no Namespace URI.
  -     * @param localName The local name of the attribute.
  -     * @return The attribute value as a string, or null if the
  -     *         attribute is not in the list.
  -     */
  -    public String getValue (String uri, String localName)
  +      if (attr.getNodeName().equals(rawName))
  +        return Integer.toString(attr.getNodeType());
  +    }
  +
  +    return null;
  +  }
  +
  +  /**
  +   * Look up an attribute's value by Namespace name.
  +   *
  +   * @param uri The Namespace URI, or the empty String if the
  +   *        name has no Namespace URI.
  +   * @param localName The local name of the attribute.
  +   * @return The attribute value as a string, or null if the
  +   *         attribute is not in the list.
  +   */
  +  public String getValue(String uri, String localName)
  +  {
  +
  +    for (int i = 0; i < getAttrCount(); i++)
       {
  -      for (int i = 0; i < getAttrCount(); i++)
  -      {
  -        AttrImpl attr = (AttrImpl)getChildAttribute(i);
  -        if (attr.getLocalName().equals(localName) &&
  -            attr.getNamespaceURI().equals(uri))
  -          return attr.getValue();
  -      }
  -      return null;
  -    } 
  +      AttrImpl attr = (AttrImpl) getChildAttribute(i);
  +
  +      if (attr.getLocalName().equals(localName)
  +              && attr.getNamespaceURI().equals(uri))
  +        return attr.getValue();
  +    }
   
  -    /**
  -     * Look up an attribute's value by raw XML 1.0 name.
  -     *
  -     * @param rawName The raw XML 1.0 name.
  -     * @return The attribute value as a string, or null if the
  -     *         attribute is not in the list or if raw names
  -     *         are not available.
  -     */
  -    public String getValue (String rawName)
  +    return null;
  +  }
  +
  +  /**
  +   * Look up an attribute's value by raw XML 1.0 name.
  +   *
  +   * @param rawName The raw XML 1.0 name.
  +   * @return The attribute value as a string, or null if the
  +   *         attribute is not in the list or if raw names
  +   *         are not available.
  +   */
  +  public String getValue(String rawName)
  +  {
  +
  +    for (int i = 0; i < getAttrCount(); i++)
       {
  -      for (int i = 0; i < getAttrCount(); i++)
  -      {
  -        AttrImpl attr = getChildAttribute(i);
  -        if (attr.getNodeName().equals(rawName))
  -          return attr.getValue();
  -      }
  -      return null;
  +      AttrImpl attr = getChildAttribute(i);
  +
  +      if (attr.getNodeName().equals(rawName))
  +        return attr.getValue();
       }
  -    
  -    ////////////////////////////  
  -    // Implement NamedNodeMap //
  -    ////////////////////////////
  -    
  -    public Node getNamedItem(String name)
  -    {
  -      return getChildAttribute(getIndex(name));
  -    }
  -
  -    /**
  -     *  Adds a node using its <code>nodeName</code> attribute. If a node 
with 
  -     * that name is already present in this map, it is replaced by the new 
  -     * one.
  -     * <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 this map. The node will later be 
  -     *   accessible using the value of its <code>nodeName</code> attribute.
  -     * @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 this map.
  -     *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this map 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.
  -     */
  -    public Node setNamedItem(Node arg)
  -                             throws DOMException
  -    {
  -      setAttribute(((Attr)arg).getName(), ((Attr)arg).getValue());
  -      return getChildAttribute(getIndex(((Attr)arg).getName()));
  -    }                                    
  -
  -    /**
  -     *  Removes a node specified by name. A removed attribute may be known 
to 
  -     * have a default value when this map contains the attributes attached 
to 
  -     * an element, as returned by the attributes attribute of the 
  -     * <code>Node</code> interface. If so, an attribute immediately appears 
  -     * containing the default value as well as the corresponding namespace 
  -     * URI, local name, and prefix when applicable.
  -     * @param name  The <code>nodeName</code> of the node to remove.
  -     * @return  The node removed from this map if a node with such a name 
  -     *   exists.
  -     * @exception DOMException
  -     *    NOT_FOUND_ERR: Raised if there is no node named <code>name</code> 
  -     *   in this map.
  -     *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
  -     */
  -    public Node removeNamedItem(String name)
  -                                throws DOMException
  -    {
  -      int index = getIndex(name);
  -      return removeItem(index);
  -    } 
  -    
  -    public Node removeItem(int index)
  -                                throws DOMException
  -    {
  -      if (index >0)
  -      {  
  -        AttrImpl attr = getChildAttribute(index);
  -        int childCount = m_children.length;
  -        Child[] newChildren = new Child[childCount-1];
  -        System.arraycopy(m_children, 0, newChildren, 0, index);
  -        System.arraycopy(m_children, index+1, newChildren, index, 
childCount-1);
  -        m_children = newChildren;
  -        attrsEnd--;  
  -      
  -        return attr;  
  +
  +    return null;
  +  }
  +
  +  ////////////////////////////  
  +  // Implement NamedNodeMap //
  +  ////////////////////////////
  +
  +  /**
  +   * NEEDSDOC Method getNamedItem 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (getNamedItem) @return
  +   */
  +  public Node getNamedItem(String name)
  +  {
  +    return getChildAttribute(getIndex(name));
  +  }
  +
  +  /**
  +   *  Adds a node using its <code>nodeName</code> attribute. If a node with
  +   * that name is already present in this map, it is replaced by the new
  +   * one.
  +   * <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 this map. The node will later be
  +   *   accessible using the value of its <code>nodeName</code> attribute.
  +   * @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 this map.
  +   *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this map 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.
  +   */
  +  public Node setNamedItem(Node arg) throws DOMException
  +  {
  +
  +    setAttribute(((Attr) arg).getName(), ((Attr) arg).getValue());
  +
  +    return getChildAttribute(getIndex(((Attr) arg).getName()));
  +  }
  +
  +  /**
  +   *  Removes a node specified by name. A removed attribute may be known to
  +   * have a default value when this map contains the attributes attached to
  +   * an element, as returned by the attributes attribute of the
  +   * <code>Node</code> interface. If so, an attribute immediately appears
  +   * containing the default value as well as the corresponding namespace
  +   * URI, local name, and prefix when applicable.
  +   * @param name  The <code>nodeName</code> of the node to remove.
  +   * @return  The node removed from this map if a node with such a name
  +   *   exists.
  +   * @exception DOMException
  +   *    NOT_FOUND_ERR: Raised if there is no node named <code>name</code>
  +   *   in this map.
  +   *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
  +   */
  +  public Node removeNamedItem(String name) throws DOMException
  +  {
  +
  +    int index = getIndex(name);
  +
  +    return removeItem(index);
  +  }
  +
  +  /**
  +   * NEEDSDOC Method removeItem 
  +   *
  +   *
  +   * NEEDSDOC @param index
  +   *
  +   * NEEDSDOC (removeItem) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node removeItem(int index) throws DOMException
  +  {
  +
  +    AttrImpl attr = m_firstAttr;
  +    int pos = 0;
  +
  +    while (null != attr)
  +    {
  +      if (pos == index)
  +      {
  +        if (null != attr.m_prev)
  +          attr.m_prev.m_next = attr.m_next;
  +
  +        if (null != m_next)
  +          attr.m_next.m_prev = attr.m_prev;
  +
  +        attr.m_next = null;
  +        attr.m_prev = null;
  +
  +        return attr;
         }
  -      else
  -        return null;
  -      
  +
  +      attr = (AttrImpl) attr.m_next;
  +
  +      pos++;
       }
  -    
  -    /**
  -     * The number of nodes (attributes) in this map. 
  -     * The range of valid child node indices 
  -     * is <code>0</code> to <code>length-1</code> inclusive. 
  -     */
  -    public int getLength()
  -    {
  -      return getAttrCount();
  -    } // getLength():int
  -
  -    /**
  -     *  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 
  -     * this map, this returns <code>null</code> .
  -     * @param index  Index into this map.
  -     * @return  The node at the <code>index</code> th position in the map, 
or 
  -     *   <code>null</code> if that is not a valid index.
  -     */
  -    public Node item(int index)
  -    {      
  -      return getChildAttribute(index);             
  -    } 
  -    
  -
  -    /**
  -     *  Retrieves a node specified by local name and namespace URI. 
HTML-only 
  -     * DOM implementations do not need to implement this method.
  -     * @param namespaceURI  The  namespace URI of the node to retrieve.
  -     * @param localName  The  local name 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 this map.
  -     * @since DOM Level 2
  -     */
  -    public Node getNamedItemNS(String namespaceURI, 
  -                               String localName)
  -    {
  -      return getChildAttribute(getIndex(namespaceURI, localName));
  -    }  
  -
  -    /**
  -     *  Adds a node using its <code>namespaceURI</code> and 
  -     * <code>localName</code> . If a node with that namespace URI and that 
  -     * local name is already present in this map, it is replaced by the new 
  -     * one.
  -     * <br> HTML-only DOM implementations do not need to implement this 
method.
  -     * @param arg  A node to store in this map. The node will later be 
  -     *   accessible using the value of its <code>namespaceURI</code> and 
  -     *   <code>localName</code> attributes.
  -     * @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 this map.
  -     *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this map 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.
  -     * @since DOM Level 2
  -     */
  -    public Node setNamedItemNS(Node arg)
  -                               throws DOMException
  -    {
  -      setAttributeNS(((Attr)arg).getNamespaceURI(), ((Attr)arg).getName(), 
((Attr)arg).getValue());
  -      return getChildAttribute(getIndex(((Attr)arg).getNamespaceURI(), 
((Attr)arg).getName()));
  -    }                                      
  -
  -    /**
  -     *  Removes a node specified by local name and namespace URI. A removed 
  -     * attribute may be known to have a default value when this map contains 
  -     * the attributes attached to an element, as returned by the attributes 
  -     * attribute of the <code>Node</code> interface. If so, an attribute 
  -     * immediately appears containing the default value as well as the 
  -     * corresponding namespace URI, local name, and prefix when applicable.
  -     * <br> HTML-only DOM implementations do not need to implement this 
method.
  -     * @param namespaceURI  The  namespace URI of the node to remove.
  -     * @param localName  The  local name of the node to remove.
  -     * @return  The node removed from this map if a node with such a local 
  -     *   name and namespace URI exists.
  -     * @exception DOMException
  -     *    NOT_FOUND_ERR: Raised if there is no node with the specified 
  -     *   <code>namespaceURI</code> and <code>localName</code> in this map.
  -     *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
  -     * @since DOM Level 2
  -     */
  -    public Node removeNamedItemNS(String namespaceURI, 
  -                                  String localName)
  -                                  throws DOMException
  -    {
  -      int index = getIndex(namespaceURI, localName);
  -      return removeItem(index);
  -    }          
   
  +    return null;
  +  }
  +
  +  /**
  +   * The number of nodes (attributes) in this map.
  +   * The range of valid child node indices
  +   * is <code>0</code> to <code>length-1</code> inclusive.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public int getLength()
  +  {
  +    return getAttrCount();
  +  }  // getLength():int
  +
  +  /**
  +   *  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
  +   * this map, this returns <code>null</code> .
  +   * @param index  Index into this map.
  +   * @return  The node at the <code>index</code> th position in the map, or
  +   *   <code>null</code> if that is not a valid index.
  +   */
  +  public Node item(int index)
  +  {
  +    return getChildAttribute(index);
  +  }
  +
  +  /**
  +   *  Retrieves a node specified by local name and namespace URI. HTML-only
  +   * DOM implementations do not need to implement this method.
  +   * @param namespaceURI  The  namespace URI of the node to retrieve.
  +   * @param localName  The  local name 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 this map.
  +   * @since DOM Level 2
  +   */
  +  public Node getNamedItemNS(String namespaceURI, String localName)
  +  {
  +    return getChildAttribute(getIndex(namespaceURI, localName));
  +  }
  +
  +  /**
  +   *  Adds a node using its <code>namespaceURI</code> and
  +   * <code>localName</code> . If a node with that namespace URI and that
  +   * local name is already present in this map, it is replaced by the new
  +   * one.
  +   * <br> HTML-only DOM implementations do not need to implement this method.
  +   * @param arg  A node to store in this map. The node will later be
  +   *   accessible using the value of its <code>namespaceURI</code> and
  +   *   <code>localName</code> attributes.
  +   * @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 this map.
  +   *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this map 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.
  +   * @since DOM Level 2
  +   */
  +  public Node setNamedItemNS(Node arg) throws DOMException
  +  {
  +
  +    setAttributeNS(((Attr) arg).getNamespaceURI(), ((Attr) arg).getName(),
  +                   ((Attr) arg).getValue());
  +
  +    return getChildAttribute(getIndex(((Attr) arg).getNamespaceURI(),
  +                                      ((Attr) arg).getName()));
  +  }
  +
  +  /**
  +   *  Removes a node specified by local name and namespace URI. A removed
  +   * attribute may be known to have a default value when this map contains
  +   * the attributes attached to an element, as returned by the attributes
  +   * attribute of the <code>Node</code> interface. If so, an attribute
  +   * immediately appears containing the default value as well as the
  +   * corresponding namespace URI, local name, and prefix when applicable.
  +   * <br> HTML-only DOM implementations do not need to implement this method.
  +   * @param namespaceURI  The  namespace URI of the node to remove.
  +   * @param localName  The  local name of the node to remove.
  +   * @return  The node removed from this map if a node with such a local
  +   *   name and namespace URI exists.
  +   * @exception DOMException
  +   *    NOT_FOUND_ERR: Raised if there is no node with the specified
  +   *   <code>namespaceURI</code> and <code>localName</code> in this map.
  +   *   <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
  +   * @since DOM Level 2
  +   */
  +  public Node removeNamedItemNS(String namespaceURI, String localName)
  +          throws DOMException
  +  {
  +
  +    int index = getIndex(namespaceURI, localName);
  +
  +    return removeItem(index);
  +  }
   }
  
  
  
  1.3       +120 -21   
xml-xalan/java/src/org/apache/xalan/stree/ElementImplWithNS.java
  
  Index: ElementImplWithNS.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/ElementImplWithNS.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ElementImplWithNS.java    2000/10/09 23:25:16     1.2
  +++ ElementImplWithNS.java    2000/10/30 18:43:48     1.3
  @@ -1,57 +1,156 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.xml.sax.Attributes;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class ElementImplWithNS <needs-comment/>
  + */
   public class ElementImplWithNS extends ElementImpl
   {
  +
  +  /** NEEDSDOC Field m_localName          */
     private String m_localName;
  +
  +  /** NEEDSDOC Field m_uri          */
     private String m_uri;
  -  
  -  ElementImplWithNS (DocumentImpl doc, String ns, String name)
  +
  +  /**
  +   * Constructor ElementImplWithNS
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param name
  +   */
  +  ElementImplWithNS(DocumentImpl doc, String ns, String name)
     {
  +
       super(doc, name);
  +
       int index = name.indexOf(':');
  -    if (index >0)
  -      m_localName = name.substring(index+1);
  +
  +    if (index > 0)
  +      m_localName = name.substring(index + 1);
       else
         m_localName = name;
  +
       m_uri = ns;
     }
  -  
  -  ElementImplWithNS (DocumentImpl doc, String ns, String localName,
  -                     String name, Attributes atts)
  +
  +  /**
  +   * Constructor ElementImplWithNS
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param atts
  +   */
  +  ElementImplWithNS(DocumentImpl doc, String ns, String localName,
  +                    String name, Attributes atts)
     {
  +
       super(doc, name, atts);
  +
       m_localName = localName;
       m_uri = ns;
     }
  -  
  +
     /**
  -   * The namespace URI of this node, or <code>null</code> if it is 
  +   * The namespace URI of this node, or <code>null</code> if it is
      * unspecified.
  -    */
  -  public String       getNamespaceURI()
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNamespaceURI()
     {
       return m_uri;
  -  }
    
  +  }
  +
     /**
  -   * The namespace prefix of this node, or <code>null</code> if it is 
  +   * The namespace prefix of this node, or <code>null</code> if it is
      * unspecified.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getPrefix()
  {
  -    String rawName = getNodeName();
    int indexOfNSSep = rawName.indexOf(':');
  -    return (indexOfNSSep >= 0) 
  -                    ? rawName.substring(0, indexOfNSSep) : null;
  +  public String getPrefix()
  +  {
  +
  +    String rawName = getNodeName();
  +    int indexOfNSSep = rawName.indexOf(':');
  +
  +    return (indexOfNSSep >= 0) ? rawName.substring(0, indexOfNSSep) : null;
     }
  -
  /**
  +
  +  /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return m_localName;
     }
  
  
  
  1.2       +85 -10    
xml-xalan/java/src/org/apache/xalan/stree/IndexedDocImpl.java
  
  Index: IndexedDocImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/IndexedDocImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IndexedDocImpl.java       2000/06/19 16:52:36     1.1
  +++ IndexedDocImpl.java       2000/10/30 18:43:48     1.2
  @@ -1,3 +1,59 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.ProcessingInstruction;
  @@ -12,36 +68,55 @@
   import org.w3c.dom.DocumentType;
   import org.w3c.dom.DOMException;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class IndexedDocImpl <needs-comment/>
  + */
   public class IndexedDocImpl extends DocumentImpl implements IndexedElem
   {
  +
  +  /**
  +   * Constructor IndexedDocImpl
  +   *
  +   */
     IndexedDocImpl()
     {
  -       super();
  +    super();
     }
   
  +  /**
  +   * Constructor IndexedDocImpl
  +   *
  +   *
  +   * NEEDSDOC @param doctype
  +   */
     IndexedDocImpl(DocumentType doctype)
     {
  -    super(doctype);    
  +    super(doctype);
     }
  -  
  +
  +  /** NEEDSDOC Field m_index          */
     private int m_index;
  -  
  -  /** 
  +
  +  /**
      * An integer indicating where this node's children can
      * be found in the indexed nodes list.
  +   *
  +   * NEEDSDOC @param anIndex
      */
  -  public void setIndex(int anIndex) 
  +  public void setIndex(int anIndex)
     {
       this.m_index = anIndex;
     }
  -  
  -  /** 
  +
  +  /**
      * An integer indicating where this node's children can
      * be found in the indexed nodes list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public int getIndex() 
  +  public int getIndex()
     {
       return m_index;
     }
  -
   }
  
  
  
  1.2       +71 -11    
xml-xalan/java/src/org/apache/xalan/stree/IndexedElem.java
  
  Index: IndexedElem.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/IndexedElem.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IndexedElem.java  2000/06/19 16:52:36     1.1
  +++ IndexedElem.java  2000/10/30 18:43:49     1.2
  @@ -1,29 +1,89 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
  +
   import org.xml.sax.Attributes;
  +
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Attr;
   import org.w3c.dom.DOMException;
  -
   
  -public interface IndexedElem 
  -  
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Interface IndexedElem
  + */
  +public interface IndexedElem
   {
  -  
   
  -  /** 
  +  /**
      * An integer indicating where this node's children can
      * be found in the indexed nodes list.
  +   *
  +   * NEEDSDOC @param anIndex
      */
     public void setIndex(int anIndex);
  -  
  -  
  -  /** 
  +
  +  /**
      * An integer indicating where this node's children can
      * be found in the indexed nodes list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getIndex();
  -  
  -
  -}  
  \ No newline at end of file
  +}
  
  
  
  1.3       +99 -15    
xml-xalan/java/src/org/apache/xalan/stree/IndexedElemImpl.java
  
  Index: IndexedElemImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/IndexedElemImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IndexedElemImpl.java      2000/10/09 23:25:16     1.2
  +++ IndexedElemImpl.java      2000/10/30 18:43:49     1.3
  @@ -1,45 +1,129 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
  +
   import org.xml.sax.Attributes;
  +
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Attr;
   import org.w3c.dom.DOMException;
  -
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class IndexedElemImpl <needs-comment/>
  + */
   public class IndexedElemImpl extends ElementImpl implements IndexedElem
  -  
   {
  +
  +  /** NEEDSDOC Field m_name          */
     private String m_name;
  -  private short attrsEnd;
  +
  +  /** NEEDSDOC Field m_attrsEnd          */
  +  private short m_attrsEnd;
  +
  +  /** NEEDSDOC Field m_index          */
     private int m_index;
  -  
  -  IndexedElemImpl (DocumentImpl doc, String name)
  +
  +  /**
  +   * Constructor IndexedElemImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param name
  +   */
  +  IndexedElemImpl(DocumentImpl doc, String name)
     {
  -    super(doc, name);    
  +    super(doc, name);
     }
   
  -  IndexedElemImpl (DocumentImpl doc, String name, Attributes atts)
  +  /**
  +   * Constructor IndexedElemImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param atts
  +   */
  +  IndexedElemImpl(DocumentImpl doc, String name, Attributes atts)
     {
  -    super(doc, name, atts);    
  +    super(doc, name, atts);
     }
   
  -  /** 
  +  /**
      * An integer indicating where this node's children can
      * be found in the indexed nodes list.
  +   *
  +   * NEEDSDOC @param anIndex
      */
  -  public void setIndex(int anIndex) 
  +  public void setIndex(int anIndex)
     {
       this.m_index = anIndex;
     }
  -  
  -  /** 
  +
  +  /**
      * An integer indicating where this node's children can
      * be found in the indexed nodes list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public int getIndex() 
  +  public int getIndex()
     {
       return m_index;
     }
  -
  -}  
  \ No newline at end of file
  +}
  
  
  
  1.3       +103 -15   
xml-xalan/java/src/org/apache/xalan/stree/IndexedElemWithNS.java
  
  Index: IndexedElemWithNS.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/IndexedElemWithNS.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IndexedElemWithNS.java    2000/10/09 23:25:17     1.2
  +++ IndexedElemWithNS.java    2000/10/30 18:43:49     1.3
  @@ -1,40 +1,128 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.xml.sax.Attributes;
   
  -public class IndexedElemWithNS extends ElementImplWithNS implements 
IndexedElem
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class IndexedElemWithNS <needs-comment/>
  + */
  +public class IndexedElemWithNS extends ElementImplWithNS
  +        implements IndexedElem
   {
  +
  +  /** NEEDSDOC Field m_localName          */
     private String m_localName;
  +
  +  /** NEEDSDOC Field m_uri          */
     private String m_uri;
  +
  +  /** NEEDSDOC Field m_index          */
     private int m_index;
  -  
  -  IndexedElemWithNS (DocumentImpl doc, String ns, String name)
  +
  +  /**
  +   * Constructor IndexedElemWithNS
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param name
  +   */
  +  IndexedElemWithNS(DocumentImpl doc, String ns, String name)
     {
  -    super(doc, ns,name);    
  +    super(doc, ns, name);
     }
  -  
  -  IndexedElemWithNS (DocumentImpl doc, String ns, String localName,
  -                     String name, Attributes atts)
  +
  +  /**
  +   * Constructor IndexedElemWithNS
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param atts
  +   */
  +  IndexedElemWithNS(DocumentImpl doc, String ns, String localName,
  +                    String name, Attributes atts)
     {
  -    super(doc, ns, localName, name, atts);    
  +    super(doc, ns, localName, name, atts);
     }
  -  
  -  /** 
  +
  +  /**
      * An integer indicating where this node's children can
      * be found in the indexed nodes list.
  +   *
  +   * NEEDSDOC @param anIndex
      */
  -  public void setIndex(int anIndex) 
  +  public void setIndex(int anIndex)
     {
       this.m_index = anIndex;
     }
  -  
  -  /** 
  +
  +  /**
      * An integer indicating where this node's children can
      * be found in the indexed nodes list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public int getIndex() 
  +  public int getIndex()
     {
       return m_index;
     }
  -  
   }
  
  
  
  1.3       +12 -8     
xml-xalan/java/src/org/apache/xalan/stree/IndexedLocPathIterator.java
  
  Index: IndexedLocPathIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/IndexedLocPathIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IndexedLocPathIterator.java       2000/07/05 14:39:04     1.2
  +++ IndexedLocPathIterator.java       2000/10/30 18:43:50     1.3
  @@ -76,24 +76,28 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * This class extends NodeSet, which implements NodeIterator, 
  + * This class extends NodeSet, which implements NodeIterator,
    * and fetches nodes one at a time in document order based on a XPath
    * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a>.
  - * As each node is iterated via nextNode(), the node is also stored 
  - * in the NodeVector, so that previousNode() can easily be done, except in 
  - * the case where the IndexedLocPathIterator is "owned" by a 
UnionPathIterator, 
  + * As each node is iterated via nextNode(), the node is also stored
  + * in the NodeVector, so that previousNode() can easily be done, except in
  + * the case where the IndexedLocPathIterator is "owned" by a 
UnionPathIterator,
    * in which case the UnionPathIterator will cache the nodes.
    */
   public class IndexedLocPathIterator extends LocPathIterator
   {
  +
     /**
      * Create a IndexedLocPathIterator object.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public IndexedLocPathIterator(Compiler compiler, int opPos)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
       super(compiler, opPos);
  -  }  
  +  }
   }
  -
  -
  
  
  
  1.3       +4 -5      
xml-xalan/java/src/org/apache/xalan/stree/IndexedUnionPathIterator.java
  
  Index: IndexedUnionPathIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/IndexedUnionPathIterator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IndexedUnionPathIterator.java     2000/07/05 14:39:06     1.2
  +++ IndexedUnionPathIterator.java     2000/10/30 18:43:50     1.3
  @@ -69,18 +69,17 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * This class extends NodeSet, which implements NodeIterator, 
  + * This class extends NodeSet, which implements NodeIterator,
    * and fetches nodes one at a time in document order based on a XPath
    * <a href="http://www.w3.org/TR/xpath#NT-UnionExpr";>UnionExpr</a>.
  - * As each node is iterated via nextNode(), the node is also stored 
  + * As each node is iterated via nextNode(), the node is also stored
    * in the NodeVector, so that previousNode() can easily be done.
    */
   public class IndexedUnionPathIterator extends UnionPathIterator
   {
  +
     /**
      * Constructor.
      */
  -  public IndexedUnionPathIterator()
  -  {
  -  }
  +  public IndexedUnionPathIterator(){}
   }
  
  
  
  1.2       +70 -11    
xml-xalan/java/src/org/apache/xalan/stree/LevelIndexIterator.java
  
  Index: LevelIndexIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/LevelIndexIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LevelIndexIterator.java   2000/06/19 16:52:37     1.1
  +++ LevelIndexIterator.java   2000/10/30 18:43:51     1.2
  @@ -1,3 +1,59 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   // DOM imports
  @@ -5,8 +61,8 @@
   import org.w3c.dom.DOMException;
   
   /**
  - * The responsibility of this class is to hide the internal workings 
  - * of the LevelIndexer from the LocPathIterator, and to return nodes 
  + * The responsibility of this class is to hide the internal workings
  + * of the LevelIndexer from the LocPathIterator, and to return nodes
    * that:
    * <ol>
    * <li>Belongs to the given parent;</li>
  @@ -17,15 +73,19 @@
    */
   public class LevelIndexIterator
   {
  +
     /**
  +   *
  +   * NEEDSDOC @param parent
  +   * NEEDSDOC @param type
  +   * NEEDSDOC @param url
  +   * NEEDSDOC @param name
      */
  -  public LevelIndexIterator(Node parent, int type, String url, String name)
  -  {
  -  }
  -  
  +  public LevelIndexIterator(Node parent, int type, String url, String name){}
  +
     /**
  -   *  Returns the next node in the set and advances the position of the 
  -   * iterator in the set. After a NodeIterator is created, the first call 
  +   *  Returns the next node in the set and advances the position of the
  +   * iterator in the set. After a NodeIterator is created, the first call
      * to nextNode() returns the first node in the set.
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  @@ -33,9 +93,8 @@
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode()
  -    throws DOMException
  +  public Node nextNode() throws DOMException
     {
       return null;
  -  }  
  +  }
   }
  
  
  
  1.3       +225 -112  
xml-xalan/java/src/org/apache/xalan/stree/LevelIndexer.java
  
  Index: LevelIndexer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/LevelIndexer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LevelIndexer.java 2000/07/21 20:57:00     1.2
  +++ LevelIndexer.java 2000/10/30 18:43:51     1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 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
  + *    software without prior written permission. For written 
    *    permission, please contact [EMAIL PROTECTED]
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -57,11 +57,14 @@
   package org.apache.xalan.stree;
   
   import org.w3c.dom.*;
  +
   import java.util.*;
  +
   import java.io.*;
  +
   import java.lang.Object;
  -import org.apache.xalan.utils.IntVector;
   
  +import org.apache.xalan.utils.IntVector;
   
   /**
    * <meta name="usage" content="general"/>
  @@ -76,188 +79,240 @@
    */
   public class LevelIndexer
   {
  +
  +  /** NEEDSDOC Field lastUsed          */
     int lastUsed;
  +
  +  /** NEEDSDOC Field m_subtype          */
     int m_subtype;
  -  int m_defaultSize = 3; // this is the default value.
   
  +  /** NEEDSDOC Field m_defaultSize          */
  +  int m_defaultSize = 3;  // this is the default value.
  +
     // change this to be new object extending from hashtable...
     //Hashtable
  -  MultiKeyTable m_elemTypes = new MultiKeyTable();  //array of element types
   
  +  /** NEEDSDOC Field m_elemTypes          */
  +  MultiKeyTable m_elemTypes = new MultiKeyTable();  //array of element types
   
     /* Array of levels in the tree.
      * Each element of this array is a nodesList element.
      */
  -  Object[] m_levelArray;    // array of levels in the tree. These are used
  -                                            // to build the elemPostings 
table.
   
  +  /** NEEDSDOC Field m_levelArray          */
  +  Object[] m_levelArray;  // array of levels in the tree. These are used
  +
  +  // to build the elemPostings table.
  +
     /**
      * Create a LevelIndexer object.
      */
     public LevelIndexer()
     {
  -       m_levelArray = new Object[10];
  -  }  
  -
  +    m_levelArray = new Object[10];
  +  }
   
     /**
      * <meta name="usage" content="internal"/>
      * Insert a node in the nodesList by level, by parent and by type.
  +   *
  +   * NEEDSDOC @param child
      */
     public void insertNode(Child child)
     {
  +
       boolean updateParent = true;
  +
       // first assign a subtype to the element and add it to the
       // m_elemTypes table.
       int type = addToTable(child);
   
  -       int uid = child.getUid();
  -    int level = child.getLevel();                  
  +    // int uid = child.getUid();
  +    int level = child.getLevel();
   
       // Nothing there yet
  -    if (m_levelArray[level]== null)
  +    if (m_levelArray[level] == null)
       {
         Object[] nodesList = new Object[m_defaultSize];
  -      m_levelArray[level] = nodesList;
   
  +      m_levelArray[level] = nodesList;
         nodesList[0] = child;
  -      ((IndexedElem)child.getParentNode()).setIndex(0);      
  +
  +      ((IndexedElem) child.getParentNode()).setIndex(0);
       }
  +
       // Add to the existing list
       else
       {
  -      Object[] nodesList = (Object[])m_levelArray[level];
  -         int structIndex = 0;
  +      Object[] nodesList = (Object[]) m_levelArray[level];
  +      int structIndex = 0;
  +
         while (structIndex < nodesList.length
  -             && (nodesList[structIndex]!= null) )
  +             && (nodesList[structIndex] != null))
         {
  -        structIndex++; 
  -         }   
  -         int lastUsed = structIndex-1;
  +        structIndex++;
  +      }
  +
  +      int lastUsed = structIndex - 1;
  +
         // TODO: cleanup
         // Need to reallocate?? 2 is the max slots we could
         // need to add plus 1 to indicate end...
         if (nodesList.length < lastUsed + 3)
  -      {                          
  -        nodesList  = allocateNewList(nodesList);
  +      {
  +        nodesList = allocateNewList(nodesList);
           m_levelArray[level] = nodesList;
         }
  -     
  +
         structIndex = 0;
  +
         while (structIndex < nodesList.length
  -             && (nodesList[structIndex]!= null))
  +             && (nodesList[structIndex] != null))
         {
  -        int next = structIndex + 1; 
  -        Child node = (Child)nodesList[structIndex];
  -        if(child.getParentNode().equals(node.getParentNode()))
  +        int next = structIndex + 1;
  +        Child node = (Child) nodesList[structIndex];
  +
  +        if (child.getParentNode().equals(node.getParentNode()))
           {
  +
             // There is already at least one node with this parent at this 
level        
             // This parent already has a pointer to its children.
             updateParent = false;
  -          if(getType(node) == type)
  +
  +          if (getType(node) == type)
             {
  +
               // This parent already has children of this type.
               // Add this child to the end of the list for this type.
               if (nodesList[next] != null)
               {
  +
                 // Slide down one
                 int i;
  +
                 for (i = lastUsed; i >= next; i--)
  -              {      
  -                if (getType((Child)nodesList[i]) != type)
  -                  nodesList[i+1] = nodesList[i];
  +              {
  +                if (getType((Child) nodesList[i]) != type)
  +                  nodesList[i + 1] = nodesList[i];
                 }
  -              nodesList[i] = child;          
  -              
  +
  +              nodesList[i] = child;
               }
               else
               {
  -              nodesList[next] = child;              
  +              nodesList[next] = child;
               }
  -            
  +
               break;
             }
  +
             structIndex = structIndex + 1;
           }
  +
           // Keep looking for this parent and this type
           else
           {
  -          structIndex = structIndex + 1; 
  +          structIndex = structIndex + 1;
           }
  -      }// end while
  +      }  // end while
   
         // First node for this parent of this type at this level
  -         if (nodesList[structIndex] == null)
  -         {   
  -                 nodesList[structIndex] = child;
  -        if (updateParent)
  -                   
((IndexedElem)child.getParentNode()).setIndex(structIndex);
  -         }   
  -    } //end else add to existing list
  +      if (nodesList[structIndex] == null)
  +      {
  +        nodesList[structIndex] = child;
   
  +        if (updateParent)
  +          ((IndexedElem) child.getParentNode()).setIndex(structIndex);
  +      }
  +    }  //end else add to existing list
     }
   
  -
     /**
      * <meta name="usage" content="internal"/>
      * Get a list of nodes in the level array by level and by type.
  +   *
  +   * NEEDSDOC @param level
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Object[] getNodesList(int level)
     {
  -    if (level > m_levelArray.length - 1 || m_levelArray[level]== null)
  -        return null;
  +
  +    if (level > m_levelArray.length - 1 || m_levelArray[level] == null)
  +      return null;
       else
       {
  -      return (Object[])m_levelArray[level];
  +      return (Object[]) m_levelArray[level];
       }
     }
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Get a list of nodes in the level array by level and by type.
  +   *
  +   * NEEDSDOC @param nodesList
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Object[] allocateNewList(Object[]nodesList)
  +  public Object[] allocateNewList(Object[] nodesList)
     {
  +
       int len = nodesList.length;
  -    Object[]newlist = new Object[len + m_defaultSize];
  +    Object[] newlist = new Object[len + m_defaultSize];
  +
       System.arraycopy(nodesList, 0, newlist, 0, len);
  -    for (int i=len; i< len + m_defaultSize; i++)
  +
  +    for (int i = len; i < len + m_defaultSize; i++)
  +    {
         newlist[i] = null;
  -    return newlist;    
  +    }
  +
  +    return newlist;
     }
   
     /**
      * <meta name="usage" content="internal"/>
      * Get index pointing to nodes of a certain type in the nodeslist.
  +   *
  +   * NEEDSDOC @param child
  +   * NEEDSDOC @param type
  +   * NEEDSDOC @param nodesList
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public int getIndexForType(Node child, int type, Object[]nodesList )
  +  public int getIndexForType(Node child, int type, Object[] nodesList)
     {
  +
       int structIndex = 0;
  +
       if (type == TYPEANY)
         return structIndex;
  -    
  -    while (structIndex < nodesList.length
  -           &&  nodesList[structIndex] != null)
  +
  +    while (structIndex < nodesList.length && nodesList[structIndex] != null)
       {
  -      int next = structIndex + 1; 
  -      Child node = (Child)nodesList[structIndex];
  -      if (child.getParentNode().equals(node.getParentNode())) 
  +
  +      // int next = structIndex + 1; 
  +      Child node = (Child) nodesList[structIndex];
  +
  +      if (child.getParentNode().equals(node.getParentNode()))
         {
  -        if(getType(node) == type)
  +        if (getType(node) == type)
           {
             return structIndex;
           }
  +
           structIndex = structIndex + 1;
         }
  +
         // Keep looking for this type
         else
         {
  -        structIndex = structIndex + 1; 
  +        structIndex = structIndex + 1;
         }
       }
  -    return -1;    // not found
  -  }
   
  +    return -1;  // not found
  +  }
   
     /**
      * <meta name="usage" content="internal"/>
  @@ -268,51 +323,73 @@
      * seperated by a double colon "::"
      * Note that m_subtype is a global variable that gets incremented
      * for the next time it is used.
  +   *
  +   * NEEDSDOC @param child
      * @return return the element subtype
      */
     public int addToTable(Child child)
     {
  +
       String uri = child.getNamespaceURI();
  -    String name = child.getNodeName(); 
  +    String name = child.getNodeName();
       String prepend = null;
  +
       // Keep track of attribute nodes
  -    if (child.getNodeType()== Node.ATTRIBUTE_NODE)
  -         prepend = "@";      
  -      
  +    if (child.getNodeType() == Node.ATTRIBUTE_NODE)
  +      prepend = "@";
  +
       // Only add new types to the table    
       int type = m_elemTypes.get(name, uri, prepend);
  +
       if (type < 0)
       {
         type = m_subtype;
  +
         m_elemTypes.put(name, uri, prepend, type);
  +
         m_subtype++;
       }
  +
       return type;
     }
   
     /**
      * <meta name="usage" content="internal"/>
      * Get type.
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param namespace
  +   * NEEDSDOC @param prepend
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getType(String name, String namespace, String prepend)
     {
  +
       int type = m_elemTypes.get(name, namespace, prepend);
  -    return  (new Integer(type).shortValue());
  -    
  +
  +    return (new Integer(type).shortValue());
     }
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Get type.
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getType(Node node)
     {
  +
       String uri = node.getNamespaceURI();
  -    String name = node.getNodeName(); 
  +    String name = node.getNodeName();
       String prepend = null;
  +
       // set up for attribute nodes
  -    if (node.getNodeType()== Node.ATTRIBUTE_NODE)
  -      prepend = "@";                   
  +    if (node.getNodeType() == Node.ATTRIBUTE_NODE)
  +      prepend = "@";
  +
       return getType(name, uri, prepend);
     }
   
  @@ -322,91 +399,127 @@
      * the tree is.
      */
     static final int MAXDEPTH = 2000;
  -  
  +
  +  /** NEEDSDOC Field TYPEANY          */
     static final int TYPEANY = 2000;
  -  
   
  -/**
  - * Implement a structure extending from Hashtable that is keyed
  - * on multiple keys.
  - */
  -  protected class MultiKeyTable //extends Hashtable
  +  /**
  +   * Implement a structure extending from Hashtable that is keyed
  +   * on multiple keys.
  +   */
  +  protected class MultiKeyTable  //extends Hashtable
     {
  +
  +    /**
  +     * Constructor MultiKeyTable
  +     *
  +     */
       protected MultiKeyTable()
       {
         super();
       }
  -    
  +
  +    /** NEEDSDOC Field m_nameTable          */
       private Hashtable m_nameTable;
  +
  +    /** NEEDSDOC Field m_uriTable          */
       private Hashtable m_uriTable;
  -    
  +
  +    /**
  +     * NEEDSDOC Method put 
  +     *
  +     *
  +     * NEEDSDOC @param name
  +     * NEEDSDOC @param namespace
  +     * NEEDSDOC @param prepend
  +     * NEEDSDOC @param value
  +     */
       public void put(String name, String namespace, String prepend, int value)
       {
  +
         IntVector nameList, uriList;
  -      
  +
         if (prepend != null)
           name = prepend + "::" + name;
  -      
  +
         if (name != null)
         {
           if (m_nameTable == null)
             m_nameTable = new Hashtable();
  -        nameList = (IntVector)m_nameTable.get(name);
  +
  +        nameList = (IntVector) m_nameTable.get(name);
  +
           if (nameList == null)
             nameList = new IntVector();
  +
           nameList.addElement(value);
           m_nameTable.put(name, nameList);
         }
  -      
  +
         if (namespace == null)
  -        namespace = "";      
  +        namespace = "";
  +
         if (m_uriTable == null)
           m_uriTable = new Hashtable();
  -      uriList =(IntVector) m_uriTable.get(namespace);      
  +
  +      uriList = (IntVector) m_uriTable.get(namespace);
  +
         if (uriList == null)
           uriList = new IntVector();
  +
         uriList.addElement(value);
         m_uriTable.put(namespace, uriList);
  -                 
       }
   
  -    public int get(String name, String namespace, String prepend)    
  +    /**
  +     * NEEDSDOC Method get 
  +     *
  +     *
  +     * NEEDSDOC @param name
  +     * NEEDSDOC @param namespace
  +     * NEEDSDOC @param prepend
  +     *
  +     * NEEDSDOC (get) @return
  +     */
  +    public int get(String name, String namespace, String prepend)
       {
  +
         IntVector nameList, uriList = null;
  +
         if (m_nameTable == null)
           return -1;
  -      
  +
         if (prepend != null)
           name = prepend + "::" + name;
  -      
  -      nameList = (IntVector)m_nameTable.get(name);      
  +
  +      nameList = (IntVector) m_nameTable.get(name);
  +
         if (nameList == null)
           return -1;
  -      
  +
         if (namespace == null)
           namespace = "";
  -      if ( m_uriTable != null)
  -      {  
  -        uriList = (IntVector)m_uriTable.get(namespace);
  +
  +      if (m_uriTable != null)
  +      {
  +        uriList = (IntVector) m_uriTable.get(namespace);
  +
           if (uriList == null)
             return -1;
  -      }       
  -      
  +      }
  +
         // Return the element that is common to both lists 
  -      for (int i=0; i< nameList.size(); i++)
  +      for (int i = 0; i < nameList.size(); i++)
         {
  -        for(int j=0; j< uriList.size(); j++)
  +        for (int j = 0; j < uriList.size(); j++)
           {
             if (nameList.elementAt(i) == uriList.elementAt(j))
               return nameList.elementAt(i);
           }
         }
  -      // Not found.
  -      return -1;        
  -     
  -    }         
  -  }  
   
  -
  +      // Not found.
  +      return -1;
  +    }
  +  }
   }
  -
  
  
  
  1.4       +73 -3     
xml-xalan/java/src/org/apache/xalan/stree/NameSpaceDecl.java
  
  Index: NameSpaceDecl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/NameSpaceDecl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NameSpaceDecl.java        2000/10/17 19:51:30     1.3
  +++ NameSpaceDecl.java        2000/10/30 18:43:51     1.4
  @@ -1,19 +1,89 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class NameSpaceDecl <needs-comment/>
  + */
   public class NameSpaceDecl extends AttrImplNS
   {
  +
  +  /**
  +   * Constructor NameSpaceDecl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param uri
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param value
  +   */
     NameSpaceDecl(DocumentImpl doc, String uri, String name, String value)
     {
       super(doc, uri, name, value);
     }
  -  
  +
     /**
      * Tell if the given node is a namespace decl node.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isNamespaceNode()
     {
       return true;
     }
  -
   }
  - 
  \ No newline at end of file
  
  
  
  1.3       +89 -17    
xml-xalan/java/src/org/apache/xalan/stree/NotationImpl.java
  
  Index: NotationImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/NotationImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NotationImpl.java 2000/08/11 19:32:08     1.2
  +++ NotationImpl.java 2000/10/30 18:43:52     1.3
  @@ -1,9 +1,71 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class NotationImpl <needs-comment/>
  + */
   public class NotationImpl
   {
  +
  +  /** NEEDSDOC Field m_name          */
     private String m_name;
   
     /** Public identifier. */
  @@ -12,50 +74,60 @@
     /** System identifier. */
     private String m_systemId;
   
  -  /** 
  +  /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() 
  +  public short getNodeType()
     {
       return Node.NOTATION_NODE;
     }
  -  
  +
     /**
      * The Public Identifier for this Notation. If no public identifier
  -   * was specified, this will be null.  
  +   * was specified, this will be null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String getPublicId() 
  +  public String getPublicId()
     {
       return m_publicId;
  -
  -  } // getPublicId():String
  +  }  // getPublicId():String
   
     /**
      * The System Identifier for this Notation. If no system identifier
  -   * was specified, this will be null.  
  +   * was specified, this will be null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String getSystemId() 
  +  public String getSystemId()
     {
       return m_systemId;
  -  } // getSystemId():String
  +  }  // getSystemId():String
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return m_name;
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return m_name;
     }
  -
   }
  
  
  
  1.11      +279 -143  xml-xalan/java/src/org/apache/xalan/stree/Parent.java
  
  Index: Parent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/Parent.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Parent.java       2000/10/09 23:25:17     1.10
  +++ Parent.java       2000/10/30 18:43:52     1.11
  @@ -1,3 +1,59 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
  @@ -10,44 +66,62 @@
   
   import org.xml.sax.SAXException;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Parent <needs-comment/>
  + */
   public class Parent extends Child
   {
  +
  +  /**
  +   * Constructor Parent
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   */
     public Parent(DocumentImpl doc)
     {
       super(doc);
     }
  -  
  -  /**
  -   * The list of children.  For space conservation reasons, 
  -   * this list is resized everytime a child is added, and is 
  -   * always exactly the size of the child count.  This is 
  -   * certainly subject to review, but I thought I'd give it 
  -   * a try and see how it works.  The alternative is to 
  -   * keep an extra int around which tells us the first free 
  -   * member in the list, etc. 
  -   */
  -  protected Child[] m_children;   
  -  
  +
  +  /** NEEDSDOC Field m_posInChildList          */
  +  protected int m_posInChildList;
  +
  +  /** NEEDSDOC Field m_childCount          */
  +  protected int m_childCount = 0;  // includes attributes, elements
  +
  +  /** NEEDSDOC Field m_isComplete          */
  +  boolean m_isComplete = false;
  +
  +  /** NEEDSDOC Field m_last          */
  +  Child m_last;
  +
  +  /** NEEDSDOC Field m_first          */
  +  Child m_first;
  +
     /**
      * Get the number of children this node currently contains.
  -   * Note that this will only return the number of children 
  -   * added so far.  If the isComplete property is false, 
  +   * Note that this will only return the number of children
  +   * added so far.  If the isComplete property is false,
      * it is likely that more children will be added.
      * DON'T CALL THIS FUNCTION IF YOU CAN HELP IT!!!
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getChildCount()
  -  {    
  +  {
  +
       if (!isComplete())
       {
  -      Object synchObj = getSynchObject();
  -      synchronized (synchObj)
  +      synchronized (m_doc)
         {
           try
           {
  +
             // Here we have to wait until the element is complete
             while (!isComplete())
             {
  -            synchObj.wait();
  +            m_doc.wait();
               throwIfParseError();
             }
           }
  @@ -55,192 +129,245 @@
           {
             throwIfParseError();
           }
  +
           //System.out.println("... getcount " );
  -        
         }
       }
  +
       //System.out.println("Waiting... Done "+ this.getNodeName() );          
  -    return (null == m_children) ? 0 : m_children.length;
  +    return m_childCount;
     }
  -  
  +
     /**
  -   *  This is a convenience method to allow easy determination of whether a 
  +   *  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, 
  +   * @return  <code>true</code> if the node has any children,
      *   <code>false</code> if the node has no children.
      */
  -  public boolean      hasChildNodes()
  {
  -    if (null == m_children && !isComplete())
  +  public boolean hasChildNodes()
  +  {
  +
  +    if (0 != m_childCount)
  +      return true;
  +    else
       {
  -      Object synchObj = getSynchObject();
  -      synchronized (synchObj)
  +      if (!isComplete())
         {
  -        try
  +        synchronized (m_doc)
           {
  -          // Only wait until the first child comes, or we are complete.
  -          while (!isComplete())
  +          try
             {
  -            synchObj.wait();
  +
  +            // Only wait until the first child comes, or we are complete.
  +            while (!isComplete())
  +            {
  +              m_doc.wait();
  +              throwIfParseError();
  +
  +              if (0 != m_childCount)
  +                break;
  +            }
  +          }
  +          catch (InterruptedException e)
  +          {
               throwIfParseError();
  -            if(null != m_children)
  -              break;
             }
           }
  -        catch (InterruptedException e)
  -        {
  -          throwIfParseError();
  -        }
  -        //System.out.println("... getcount " );        
         }
  +
  +      return (0 == m_childCount) ? false : true;
       }
  -    //System.out.println("Waiting(haschildnodes)... Done "+ 
this.getNodeName() );
  -    return (null == m_children || m_children.length == 0) ? false : true;
  }
  -  
  +  }
  +
     /**
      * <meta name="usage" content="internal"/>
      * Get the position of the child of an element in the document.
      * Note that this is assuming an index starting at 1
  +   *
  +   * NEEDSDOC @param pos
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getChildUID(int pos)
  -  {        
  +  {
  +
       Child child = getChild(pos);
  +
       return (null != child) ? child.getUid() : -1;
     }
  -  
  +
     /**
      * Get the nth child.
      * @param i the index of the child.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception ArrayIndexOutOfBoundsException if the index is out of bounds.
      * @exception NullPointerException if there are no children.
      */
     public Child getChild(int i)
  -    throws ArrayIndexOutOfBoundsException, NullPointerException
  +          throws ArrayIndexOutOfBoundsException, NullPointerException
     {
  -      Child child = ((null != m_children) && (i >= 0) && i < 
m_children.length) ?
  -                    m_children[i] : null;
  -      if (child == null && !isComplete())
  +
  +    if (i < 0)
  +      return null;
  +    else if ((i >= m_childCount) &&!isComplete())
  +    {
  +      synchronized (m_doc)
         {
  -        Object synchObj = getSynchObject();
  -        synchronized (synchObj)
  +        try
           {
  -          try
  -          {
  -            // System.out.println("Waiting... getChild " + i + " " + 
getNodeName());
  -            while (!isComplete())
  -            {
  -              synchObj.wait();
  -              throwIfParseError();
  -              // System.out.println("... gotChild " + i);
  -              child = ((null != m_children) && (i >= 0) && i < 
m_children.length) ?
  -                      m_children[i] : null;
  -              if(null != child)
  -                break;
  -            }
  -          }
  -          catch (InterruptedException e)
  +
  +          // System.out.println("Waiting... getChild " + i + " " + 
getNodeName());
  +          while (!isComplete())
             {
  +            m_doc.wait();
               throwIfParseError();
  +
  +            if (i < m_childCount)
  +              break;
             }
  +        }
  +        catch (InterruptedException e)
  +        {
  +          throwIfParseError();
  +        }
  +      }
  +    }
  +
  +    if (i < m_childCount)
  +    {
  +      Child child = m_first;
  +      int pos = 0;
  +
  +      while (null != child)
  +      {
  +        if (pos == i)
  +        {
  +          return child;
           }
  -      }  
  -      return child;
  +
  +        child = child.m_next;
  +
  +        pos++;
  +      }
  +    }
  +
  +    return null;
     }
  -  
  +
     /**
  -   * The first child of this node. If there is no such node, this returns 
  +   * The first child of this node. If there is no such node, this returns
      * <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node         getFirstChild()
  +  public Node getFirstChild()
     {
  -    if (!hasChildNodes())
  -      return null;
  -    else        
      return getChild(0);
  -  }
  
  +
  +    if (null != m_first)
  +      return m_first;
  +    else if (!m_isComplete)
  +    {
  +      synchronized (m_doc)
  +      {
  +        try
  +        {
  +
  +          // System.out.println("Waiting... getChild " + i + " " + 
getNodeName());
  +          while (!isComplete())
  +          {
  +            m_doc.wait();
  +            throwIfParseError();
  +
  +            if (null != m_first)
  +              return m_first;
  +          }
  +        }
  +        catch (InterruptedException e)
  +        {
  +          throwIfParseError();
  +        }
  +      }
  +    }
  +
  +    return m_first;
  +  }
  +
     /**
  -   * The last child of this node. If there is no such node, this returns 
  +   * The last child of this node. If there is no such node, this returns
      * <code>null</code>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node         getLastChild()
  +  public Node getLastChild()
     {
  +
       try
  -    {
      return getChild(getChildCount()-1);
  +    {
  +      return getChild(getChildCount() - 1);
       }
  -    catch(Exception e)
  +    catch (Exception e)
       {
         throw new org.apache.xalan.utils.WrappedRuntimeException(e);
  -    }  
  +    }
     }
  -  
  +
     /**
      * Append a child to the child list.
      * @param newChild Must be a org.apache.xalan.stree.Child.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception ClassCastException if the newChild isn't a 
org.apache.xalan.stree.Child.
  +   *
  +   * @throws DOMException
      */
  -  public Node appendChild(Node newChild)
  -    throws DOMException
  +  public Node appendChild(Node newChild) throws DOMException
     {
  -    int childCount;
  -    if(null == m_children)
  +
  +    Child child = (Child) newChild;
  +    DocumentImpl doc = m_doc;
  +
  +    child.m_parent = this;
  +
  +    m_childCount++;
  +
  +    child.m_uid = ++m_doc.m_docOrderCount;
  +    child.m_level = (short) (m_level + 1);
  +
  +    if (null == m_first)
       {
  -      m_children = new Child[1];
  -      childCount = 0;
  +      m_first = child;
       }
       else
       {
  -      childCount = m_children.length;
  -      Child[] newChildren = new Child[childCount+1];
  -      System.arraycopy(m_children, 0, newChildren, 0, childCount);
  -      // Child prevChild = m_children[childCount-1];
  -      m_children = newChildren;
  +      m_last.m_next = child;
  +      child.m_prev = m_last;
       }
  -    
  -    Child child = (Child)newChild;
  -    child.SetChildPosition(childCount);
  -    m_children[childCount] = child;
   
  -    DocumentImpl doc;
  -    try
  -    {
  -      doc = (DocumentImpl)this.getOwnerDocument();
  -      doc.incrementDocOrderCount();
  -      child.setUid(doc.getDocOrderCount());
  -      
  -      // I think this was put in to handle Result tree fragments.
  -      // Maybe endDocument is not being called??    
  -      if(!doc.getUseMultiThreading() && (child instanceof Parent))
  -        ((Parent)child).setComplete(true);
  +    m_last = child;
   
  -    }
  -    catch(ClassCastException cce)
  -    {
  -      // TODO: Make ResultTreeFrag be an Stree DocumentFragment, or some 
such.
  -      // No owner doc, so we can't set the document order count, 
  -      // which will be a problem when result tree fragments need to 
  -      // be treated like node-sets.
  -      doc = null;
  -      if(child instanceof Parent) // for now DocumentFragments can't be 
built on another thread.
  -        ((Parent)child).setComplete(true);
  -    }
  -    child.setParent(this);
  -    child.setLevel((short)(getLevel() + 1));
       // getDocumentImpl().getLevelIndexer().insertNode(child);
  -    
  -    if((null != doc) && (Node.ELEMENT_NODE == child.getNodeType()))
  +    if (Node.ELEMENT_NODE == child.getNodeType())
       {
         SourceTreeHandler sh = doc.getSourceTreeHandler();
  -      if(null != sh)
  +
  +      if ((null != sh) && sh.m_shouldCheckWhitespace)
         {
           TransformerImpl transformer = sh.getTransformer();
  -        if(null != transformer)
  +
  +        if (null != transformer)
           {
  -          StylesheetRoot stylesheet= transformer.getStylesheet();
  +          StylesheetRoot stylesheet = transformer.getStylesheet();
  +
             try
             {
  -            ElementImpl elem = (ElementImpl)child;
  -            WhiteSpaceInfo info 
  -              = stylesheet.getWhiteSpaceInfo(transformer.getXPathContext(), 
elem);
  +            ElementImpl elem = (ElementImpl) child;
  +            WhiteSpaceInfo info =
  +              stylesheet.getWhiteSpaceInfo(transformer.getXPathContext(),
  +                                           elem);
               boolean shouldStrip;
  -            if(null == info)
  +
  +            if (null == info)
               {
                 shouldStrip = sh.getShouldStripWhitespace();
               }
  @@ -248,49 +375,58 @@
               {
                 shouldStrip = info.getShouldStripSpace();
               }
  +
               sh.setShouldStripWhitespace(shouldStrip);
             }
  -          catch(SAXException se)
  +          catch (SAXException se)
             {
  +
               // TODO: Diagnostics
             }
           }
         }
       }
  +
       return newChild;
  -  }  
  +  }
   
  -  
     /**
  -   * Flag that tells if this node is complete.
  -   */
  -  private boolean m_isComplete = false;
  -    
  -  /**
  -   * Return if this node has had all it's children added, i.e. 
  +   * Return if this node has had all it's children added, i.e.
      * if a endElement event has occured.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isComplete()
     {
  -    if(!m_isComplete)
  -      throwIfParseError();
  +
  +    if (!m_isComplete && (null != m_doc.m_exceptionThrown))
  +      throwParseError(m_doc.m_exceptionThrown);
  +
       return m_isComplete;
     }
  -  
  +
     /**
  -   * Set that this node's child list is complete, i.e. 
  +   * Set that this node's child list is complete, i.e.
      * an endElement event has occured.
  +   *
  +   * NEEDSDOC @param isComplete
      */
     public void setComplete(boolean isComplete)
     {
       m_isComplete = isComplete;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method throwParseError 
  +   *
  +   *
  +   * NEEDSDOC @param e
  +   */
     protected void throwParseError(Exception e)
     {
  +
       m_isComplete = true;
  +
       super.throwParseError(e);
     }
  -
  -
   }
  
  
  
  1.4       +107 -20   
xml-xalan/java/src/org/apache/xalan/stree/ProcessingInstructionImpl.java
  
  Index: ProcessingInstructionImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/ProcessingInstructionImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ProcessingInstructionImpl.java    2000/10/09 23:25:17     1.3
  +++ ProcessingInstructionImpl.java    2000/10/30 18:43:53     1.4
  @@ -1,51 +1,129 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.ProcessingInstruction;
   
  -public class ProcessingInstructionImpl extends Child 
  -  implements ProcessingInstruction
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class ProcessingInstructionImpl <needs-comment/>
  + */
  +public class ProcessingInstructionImpl extends Child
  +        implements ProcessingInstruction
   {
  +
  +  /** NEEDSDOC Field m_name          */
     private String m_name;
  +
  +  /** NEEDSDOC Field m_data          */
     private String m_data;
  -  
  +
     /**
      * Implement the processingInstruction event.
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param target
  +   * NEEDSDOC @param data
      */
     ProcessingInstructionImpl(DocumentImpl doc, String target, String data)
     {
  +
       super(doc);
  +
       m_name = target;
       m_data = data;
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return m_name;
     }
  -  
  -  /** Get the PI name. */
  +
  +  /**
  +   * Get the PI name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getNodeName()
     {
       return m_name;
     }
  -  
  +
     /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() 
  +  public short getNodeType()
     {
       return Node.PROCESSING_INSTRUCTION_NODE;
     }
  -  
  +
     /**
      * A PI's "target" states what processor channel the PI's data
      * should be directed to. It is defined differently in HTML and XML.
  @@ -56,27 +134,36 @@
      * In HTML, target is always null.
      * <p>
      * Note that getNodeName is aliased to getTarget.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String getTarget() 
  +  public String getTarget()
     {
       return m_name;
  -  } // getTarget():String
  +  }  // getTarget():String
   
     /**
  -   * The content of this processing instruction. This is from the first non 
  -   * white space character after the target to the character immediately 
  +   * 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>.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception DOMException
      *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
      */
  -  public String       getData()
  +  public String getData()
     {
       return m_data;
     }
  -  
  -  public String getNodeValue() 
  +
  +  /**
  +   * NEEDSDOC Method getNodeValue 
  +   *
  +   *
  +   * NEEDSDOC (getNodeValue) @return
  +   */
  +  public String getNodeValue()
     {
       return m_data;
     }
  -
   }
  
  
  
  1.14      +404 -159  
xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java
  
  Index: SourceTreeHandler.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/SourceTreeHandler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SourceTreeHandler.java    2000/10/17 18:56:44     1.13
  +++ SourceTreeHandler.java    2000/10/30 18:43:53     1.14
  @@ -1,15 +1,77 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import java.util.Stack;
  +
   import org.w3c.dom.Node;
  +
   import org.xml.sax.ContentHandler;
  +
   import org.apache.xalan.utils.DOMBuilder;
   import org.apache.xalan.utils.XMLCharacterRecognizer;
  +import org.apache.xalan.utils.BoolStack;
   import org.apache.xpath.XPathContext;
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.templates.StylesheetRoot;
   import org.apache.xalan.templates.WhiteSpaceInfo;
  +
   import org.w3c.dom.Document;
  +
   import org.xml.sax.Attributes;
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.ext.LexicalHandler;
  @@ -17,34 +79,49 @@
   import org.xml.sax.SAXException;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.InputSource;
  +
   import org.apache.trax.Transformer;
   
   /**
  - * This class handles SAX2 parse events to create a source 
  + * This class handles SAX2 parse events to create a source
    * tree for transformation.
    */
   public class SourceTreeHandler implements ContentHandler, LexicalHandler
   {
  +
     /**
  -   * Create a SourceTreeHandler that will start a transformation as 
  +   * Create a SourceTreeHandler that will start a transformation as
      * soon as a startDocument occurs.
  +   *
  +   * NEEDSDOC @param transformer
      */
     public SourceTreeHandler(TransformerImpl transformer)
     {
  +
       m_transformer = transformer;
  -    XPathContext xctxt = ((TransformerImpl)transformer).getXPathContext();
  +
  +    XPathContext xctxt = ((TransformerImpl) transformer).getXPathContext();
  +
       xctxt.setDOMHelper(new StreeDOMHelper());
  -    if (indexedLookup)
  -      m_root = new IndexedDocImpl();
  -    else
  -      m_root = new DocumentImpl(this);  
  -    
  +
  +    // if (indexedLookup)
  +    //  m_root = new IndexedDocImpl();
  +    // else
  +    m_root = new DocumentImpl(this);
  +
       String urlOfSource = transformer.getBaseURLOfSource();
  -    if(null == m_inputSource)
  +
  +    if (null == m_inputSource)
       {
         m_inputSource = new InputSource(urlOfSource);
       }
  -    
transformer.getXPathContext().getSourceTreeManager().putDocumentInCache(m_root, 
m_inputSource);
  +
  +    transformer.getXPathContext().getSourceTreeManager().putDocumentInCache(
  +      m_root, m_inputSource);
  +
  +    m_initedRoot = false;
  +    m_shouldCheckWhitespace =
  +      transformer.getStylesheet().shouldCheckWhitespace();
     }
   
     /**
  @@ -52,28 +129,44 @@
      */
     public SourceTreeHandler()
     {
  +
  +    // if (indexedLookup)
  +    //  m_root = new IndexedDocImpl();
  +    // else
  +    m_root = new DocumentImpl(this);
  +    m_initedRoot = false;
     }
  -  
  -  private TransformerImpl m_transformer;
  +
  +  /** NEEDSDOC Field m_transformer          */
  +  TransformerImpl m_transformer;
  +
  +  /**
  +   * NEEDSDOC Method getTransformer 
  +   *
  +   *
  +   * NEEDSDOC (getTransformer) @return
  +   */
     public TransformerImpl getTransformer()
     {
       return m_transformer;
     }
  -
  -  Object getSynchObject()
  -  {
  -    if (null != m_transformer) 
  -      return m_transformer;
  -    else
  -      return this;
  -  }
   
  +  /** NEEDSDOC Field m_sourceTreeHandler          */
     private DOMBuilder m_sourceTreeHandler;
  -  
  -  private Document m_root; // Normally a Document
  -  
  +
  +  /** NEEDSDOC Field m_root          */
  +  private Document m_root;  // Normally a Document
  +
  +  /** NEEDSDOC Field m_initedRoot          */
  +  private boolean m_initedRoot;
  +
  +  /** NEEDSDOC Field m_shouldCheckWhitespace          */
  +  boolean m_shouldCheckWhitespace = false;
  +
     /**
      * Get the root document of tree that is being or will be created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getRoot()
     {
  @@ -82,19 +175,45 @@
   
     /**
      * Set the root document of tree will be created.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Document root)
     {
  -    m_root = root;    
  +    m_root = root;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setExceptionThrown 
  +   *
  +   *
  +   * NEEDSDOC @param e
  +   */
  +  public void setExceptionThrown(Exception e)
  +  {
  +    ((DocumentImpl) m_root).m_exceptionThrown = e;
  +  }
  +
  +  /** NEEDSDOC Field m_inputSource          */
     InputSource m_inputSource;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setInputSource 
  +   *
  +   *
  +   * NEEDSDOC @param source
  +   */
     public void setInputSource(InputSource source)
     {
       m_inputSource = source;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getInputSource 
  +   *
  +   *
  +   * NEEDSDOC (getInputSource) @return
  +   */
     public InputSource getInputSource()
     {
       return m_inputSource;
  @@ -102,67 +221,81 @@
   
     /**
      * Implement the setDocumentLocator event.
  +   *
  +   * NEEDSDOC @param locator
      */
  -  public void setDocumentLocator (Locator locator)
  -  {
  -  }
  -  
  +  public void setDocumentLocator(Locator locator){}
  +
  +  /** NEEDSDOC Field m_useMultiThreading          */
     private boolean m_useMultiThreading = false;
  -  
  +
     /**
  -   * Set whether or not the tree being built should handle 
  +   * Set whether or not the tree being built should handle
      * transformation while the parse is still going on.
  +   *
  +   * NEEDSDOC @param b
      */
     public void setUseMultiThreading(boolean b)
     {
       m_useMultiThreading = b;
     }
  -  
  +
     /**
  -   * Tell whether or not the tree being built should handle 
  +   * Tell whether or not the tree being built should handle
      * transformation while the parse is still going on.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean getUseMultiThreading()
     {
       return m_useMultiThreading;
     }
  +
  +  /** NEEDSDOC Field indexedLookup          */
  +  private boolean indexedLookup = false;  // for now 
   
  -  
  -  private boolean indexedLookup = false;      // for now 
  -  
  +  /** NEEDSDOC Field m_eventsCount          */
     private int m_eventsCount = 0;
  -  private int m_maxEventsToNotify = 10;
  -  
  +
  +  /** NEEDSDOC Field m_maxEventsToNotify          */
  +  private int m_maxEventsToNotify = 18;
  +
  +  /**
  +   * NEEDSDOC Method notifyWaiters 
  +   *
  +   */
     private void notifyWaiters()
     {
  -    if(m_useMultiThreading && (m_eventsCount >= m_maxEventsToNotify))
  +
  +    if (m_useMultiThreading && (m_eventsCount >= m_maxEventsToNotify))
       {
  -      Object synchObj = getSynchObject();
  +      Object synchObj = m_root;
  +
         synchronized (synchObj)
  -      {      
  -        synchObj.notifyAll();
  +      {
  +        synchObj.notify();
         }
  +
         m_eventsCount = 0;
       }
       else
         m_eventsCount++;
     }
  -  
  -    
  +
     /**
      * Implement the startDocument event.
  +   *
  +   * @throws SAXException
      */
  -  public void startDocument ()
  -    throws SAXException
  -  {    
  -    synchronized (getSynchObject())
  +  public void startDocument() throws SAXException
  +  {
  +
  +    synchronized (m_root)
       {
  -      if(null == m_root)
  +
  +      /*
  +      if(false == m_initedRoot)
         {
  -        if (indexedLookup)
  -          m_root = new IndexedDocImpl();
  -        else
  -          m_root = new DocumentImpl(this);  
           if(null != m_transformer)
           {
             String urlOfSource = m_transformer.getBaseURLOfSource();
  @@ -173,24 +306,32 @@
             
m_transformer.getXPathContext().getSourceTreeManager().putDocumentInCache(m_root,
 m_inputSource);
           }
         }
  -      ((DocumentImpl)m_root).setSourceTreeHandler(this);
  -      ((DocumentImpl)m_root).setUid(1);
  -      ((DocumentImpl)m_root).setLevel(new Integer(1).shortValue());
  -      ((DocumentImpl)m_root).setUseMultiThreading(getUseMultiThreading());
  +      */
  +      ((DocumentImpl) m_root).setSourceTreeHandler(this);
  +      ((DocumentImpl) m_root).setUid(1);
  +      ((DocumentImpl) m_root).setLevel(new Integer(1).shortValue());
  +      ((DocumentImpl) m_root).setUseMultiThreading(getUseMultiThreading());
   
         m_sourceTreeHandler = new StreeDOMBuilder(m_root);
  -      pushShouldStripWhitespace(false);    
   
  +      pushShouldStripWhitespace(false);
         m_sourceTreeHandler.startDocument();
  -      
       }
  -    if(m_useMultiThreading && (null != m_transformer))
  +
  +    if (m_useMultiThreading && (null != m_transformer))
       {
  -      if(m_transformer.isParserEventsOnMain())
  +      if (m_transformer.isParserEventsOnMain())
         {
           m_transformer.setSourceTreeDocForThread(m_root);
  +
           Thread t = new Thread(m_transformer);
  +
           m_transformer.setTransformThread(t);
  +
  +        int cpriority = Thread.currentThread().getPriority();
  +
  +        // t.setPriority(cpriority-1);
  +        t.setPriority(cpriority);
           t.start();
         }
       }
  @@ -200,53 +341,92 @@
   
     /**
      * Implement the endDocument event.
  +   *
  +   * @throws SAXException
      */
  -  public void endDocument ()
  -    throws SAXException
  +  public void endDocument() throws SAXException
     {
  -    Object synchObj = getSynchObject();
  +
  +    ((Parent) m_root).setComplete(true);
  +
  +    m_eventsCount = m_maxEventsToNotify;
  +
  +    notifyWaiters();
  +
  +    Object synchObj = m_root;
  +
       synchronized (synchObj)
       {
  -      ((Parent)m_root).setComplete(true);    
         m_sourceTreeHandler.endDocument();
  -      popShouldStripWhitespace();    
  -      
  -      if(!m_useMultiThreading && (null != m_transformer))
  +      popShouldStripWhitespace();
  +
  +      if (!m_useMultiThreading && (null != m_transformer))
         {
           m_transformer.transformNode(m_root);
         }
       }
  +
       m_eventsCount = m_maxEventsToNotify;
  +
       notifyWaiters();
  -    
  -    if(m_useMultiThreading && (null != m_transformer))
  +
  +    // printTree(m_root);
  +    if (m_useMultiThreading && (null != m_transformer))
       {
         Thread transformThread = m_transformer.getTransformThread();
  -      if(null != transformThread)
  +
  +      if (null != transformThread)
         {
           try
           {
  +
             // This should wait until the transformThread is considered not 
alive.
             transformThread.join();
             m_transformer.setTransformThread(null);
  -        }
  -        catch(InterruptedException ie)
  -        {
           }
  +        catch (InterruptedException ie){}
         }
       }
     }
   
     /**
  +   * NEEDSDOC Method printTree 
  +   *
  +   *
  +   * NEEDSDOC @param n
  +   */
  +  private void printTree(Node n)
  +  {
  +
  +    System.out.println("node: " + n.getNodeName());
  +
  +    Node child;
  +
  +    for (child = n.getFirstChild(); child != null;
  +            child = child.getNextSibling())
  +    {
  +      printTree(child);
  +    }
  +  }
  +
  +  /**
      * Implement the startElement event.
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param atts
  +   *
  +   * @throws SAXException
      */
  -  public void startElement (String ns, String localName,
  -                            String name, Attributes atts)
  -    throws SAXException
  +  public void startElement(
  +          String ns, String localName, String name, Attributes atts)
  +            throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
  -      pushShouldStripWhitespace(getShouldStripWhitespace());
  +      m_shouldStripWhitespaceStack.push(m_shouldStripWS);
         m_sourceTreeHandler.startElement(ns, localName, name, atts);
       }
   
  @@ -255,23 +435,31 @@
   
     /**
      * Implement the endElement event.
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   *
  +   * @throws SAXException
      */
  -  public void endElement (String ns, String localName,
  -                          String name)
  -    throws SAXException
  +  public void endElement(String ns, String localName, String name)
  +          throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
  -      ((Parent)m_sourceTreeHandler.getCurrentNode()).setComplete(true);
  +      ((Parent) m_sourceTreeHandler.getCurrentNode()).setComplete(true);
         m_sourceTreeHandler.endElement(ns, localName, name);
  -      popShouldStripWhitespace(); 
  +
  +      m_shouldStripWS = m_shouldStripWhitespaceStack.popAndTop();
       }
   
       notifyWaiters();
     }
   
  +  /** NEEDSDOC Field m_isCData          */
     private boolean m_isCData = false;
  -  
  +
     /**
      * Report the start of a CDATA section.
      *
  @@ -282,79 +470,111 @@
      * @exception SAXException The application may raise an exception.
      * @see #endCDATA
      */
  -  public void startCDATA ()
  -    throws SAXException
  +  public void startCDATA() throws SAXException
     {
       m_isCData = true;
     }
  -  
  +
     /**
      * Report the end of a CDATA section.
      *
      * @exception SAXException The application may raise an exception.
      * @see #startCDATA
      */
  -  public void endCDATA ()
  -    throws SAXException
  +  public void endCDATA() throws SAXException
     {
       m_isCData = false;
     }
  -  
  +
     /**
      * Implement the characters event.
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
      */
  -  public void characters (char ch[], int start, int length)
  -    throws SAXException
  +  public void characters(char ch[], int start, int length) throws 
SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
  -      if(XMLCharacterRecognizer.isWhiteSpace(ch, start, length) && 
getShouldStripWhitespace())
  +      if (m_shouldStripWS
  +              && XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
           return;
  -      
  -      if(m_isCData)
  +
  +      if (m_isCData)
           m_sourceTreeHandler.cdata(ch, start, length);
         else
           m_sourceTreeHandler.characters(ch, start, length);
       }
  +
       notifyWaiters();
     }
   
     /**
      * Implement the characters event.
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
      */
  -  public void charactersRaw (char ch[], int start, int length)
  -    throws SAXException
  +  public void charactersRaw(char ch[], int start, int length)
  +          throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
         m_sourceTreeHandler.charactersRaw(ch, start, length);
       }
  +
       notifyWaiters();
     }
   
     /**
      * Implement the ignorableWhitespace event.
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
      */
  -  public void ignorableWhitespace (char ch[], int start, int length)
  -    throws SAXException
  +  public void ignorableWhitespace(char ch[], int start, int length)
  +          throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
  -      m_sourceTreeHandler.charactersRaw(ch, start, length);
  +      if (m_shouldStripWS)
  +        return;
  +
  +      m_sourceTreeHandler.characters(ch, start, length);
       }
  +
       notifyWaiters();
     }
   
     /**
      * Implement the processingInstruction event.
  +   *
  +   * NEEDSDOC @param target
  +   * NEEDSDOC @param data
  +   *
  +   * @throws SAXException
      */
  -  public void processingInstruction (String target, String data)
  -    throws SAXException
  +  public void processingInstruction(String target, String data)
  +          throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
         m_sourceTreeHandler.processingInstruction(target, data);
       }
  +
       notifyWaiters();
     }
   
  @@ -370,16 +590,17 @@
      * @param length The number of characters to use from the array.
      * @exception SAXException The application may raise an exception.
      */
  -  public void comment (char ch[], int start, int length)
  -    throws SAXException
  +  public void comment(char ch[], int start, int length) throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
         m_sourceTreeHandler.comment(ch, start, length);
       }
  +
       notifyWaiters();
     }
  -  
  +
     /**
      * Report the beginning of an entity.
      *
  @@ -399,13 +620,14 @@
      * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
      * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
      */
  -  public void startEntity (String name)
  -    throws SAXException
  +  public void startEntity(String name) throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
         m_sourceTreeHandler.startEntity(name);
       }
  +
       notifyWaiters();
     }
   
  @@ -416,16 +638,17 @@
      * @exception SAXException The application may raise an exception.
      * @see #startEntity
      */
  -  public void endEntity (String name)
  -    throws SAXException
  +  public void endEntity(String name) throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
         m_sourceTreeHandler.endEntity(name);
       }
  +
       notifyWaiters();
     }
  -  
  +
     /**
      * Report the start of DTD declarations, if any.
      *
  @@ -443,12 +666,8 @@
      * @see #endDTD
      * @see #startEntity
      */
  -  public void startDTD (String name, String publicId,
  -                        String systemId)
  -    throws SAXException
  -  {
  -  }
  -
  +  public void startDTD(String name, String publicId, String systemId)
  +          throws SAXException{}
   
     /**
      * Report the end of DTD declarations.
  @@ -456,16 +675,13 @@
      * @exception SAXException The application may raise an exception.
      * @see #startDTD
      */
  -  public void endDTD ()
  -    throws SAXException
  -  {
  -  }
  +  public void endDTD() throws SAXException{}
   
     /**
      * Begin the scope of a prefix-URI Namespace mapping.
      *
      * <p>The information from this event is not necessary for
  -   * normal Namespace processing: the SAX XML reader will 
  +   * normal Namespace processing: the SAX XML reader will
      * automatically replace prefixes for element and attribute
      * names when the http://xml.org/sax/features/namespaces
      * feature is true (the default).</p>
  @@ -490,14 +706,18 @@
      *            an exception during processing.
      * @see #endPrefixMapping
      * @see #startElement
  +   *
  +   * @throws SAXException
      */
  -  public void startPrefixMapping (String prefix, String uri)
  -    throws SAXException
  +  public void startPrefixMapping(String prefix, String uri)
  +          throws SAXException
     {
  -    synchronized (getSynchObject())
  +
  +    synchronized (m_root)
       {
         m_sourceTreeHandler.startPrefixMapping(prefix, uri);
       }
  +
       // System.out.println("DOMBuilder.startPrefixMapping("+prefix+", 
"+uri+");");
     }
   
  @@ -514,13 +734,14 @@
      *            an exception during processing.
      * @see #startPrefixMapping
      * @see #endElement
  +   *
  +   * @throws SAXException
      */
  -  public void endPrefixMapping (String prefix)
  -    throws SAXException
  +  public void endPrefixMapping(String prefix) throws SAXException
     {
       m_sourceTreeHandler.endPrefixMapping(prefix);
     }
  -  
  +
     /**
      * Receive notification of a skipped entity.
      *
  @@ -533,42 +754,66 @@
      * http://xml.org/sax/features/external-parameter-entities
      * properties.</p>
      *
  -   * @param name The name of the skipped entity.  If it is a 
  +   * @param name The name of the skipped entity.  If it is a
      *        parameter entity, the name will begin with '%'.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  +   *
  +   * @throws SAXException
      */
  -  public void skippedEntity (String name)
  -    throws SAXException
  -  {
  -  }
  -  
  -  static private Boolean S_TRUE = new Boolean(true);
  -  static private Boolean S_FALSE = new Boolean(false);
  -                                              
  -  private Stack m_shouldStripWhitespace = new Stack();
  -  
  +  public void skippedEntity(String name) throws SAXException{}
  +
  +  /** NEEDSDOC Field m_shouldStripWS          */
  +  private boolean m_shouldStripWS = false;
  +
  +  /** NEEDSDOC Field m_shouldStripWhitespaceStack          */
  +  private BoolStack m_shouldStripWhitespaceStack = new BoolStack();
  +
  +  /**
  +   * NEEDSDOC Method getShouldStripWhitespace 
  +   *
  +   *
  +   * NEEDSDOC (getShouldStripWhitespace) @return
  +   */
     boolean getShouldStripWhitespace()
     {
  -    return (m_shouldStripWhitespace.empty() ? 
  -            false : (m_shouldStripWhitespace.peek() == S_TRUE));
  +    return m_shouldStripWS;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method pushShouldStripWhitespace 
  +   *
  +   *
  +   * NEEDSDOC @param shouldStrip
  +   */
     void pushShouldStripWhitespace(boolean shouldStrip)
     {
  -    m_shouldStripWhitespace.push(shouldStrip ? S_TRUE : S_FALSE);
  +
  +    m_shouldStripWS = shouldStrip;
  +
  +    m_shouldStripWhitespaceStack.push(shouldStrip);
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method popShouldStripWhitespace 
  +   *
  +   */
     void popShouldStripWhitespace()
     {
  -    m_shouldStripWhitespace.pop();
  +    m_shouldStripWS = m_shouldStripWhitespaceStack.popAndTop();
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setShouldStripWhitespace 
  +   *
  +   *
  +   * NEEDSDOC @param shouldStrip
  +   */
     void setShouldStripWhitespace(boolean shouldStrip)
     {
  -    popShouldStripWhitespace();
  -    pushShouldStripWhitespace(shouldStrip);
  -  }
   
  +    m_shouldStripWS = shouldStrip;
   
  +    m_shouldStripWhitespaceStack.setTop(shouldStrip);
  +  }
   }
  
  
  
  1.2       +184 -14   
xml-xalan/java/src/org/apache/xalan/stree/StreeDOMBuilder.java
  
  Index: StreeDOMBuilder.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/StreeDOMBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StreeDOMBuilder.java      2000/08/04 22:26:25     1.1
  +++ StreeDOMBuilder.java      2000/10/30 18:43:53     1.2
  @@ -1,3 +1,59 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.apache.xalan.utils.DOMBuilder;
  @@ -7,44 +63,158 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.Element;
   
  +import org.xml.sax.SAXException;
  +
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class StreeDOMBuilder <needs-comment/>
  + */
   public class StreeDOMBuilder extends DOMBuilder
   {
  -  
  +
  +  /** NEEDSDOC Field m_docImpl          */
  +  protected DocumentImpl m_docImpl;
  +
     /**
  -   * StreeDOMBuilder instance constructor... it will add the DOM nodes 
  +   * StreeDOMBuilder instance constructor... it will add the DOM nodes
      * to the document fragment.
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param node
      */
     public StreeDOMBuilder(Document doc, Node node)
     {
  +
       super(doc, node);
  +
  +    m_docImpl = (DocumentImpl) doc;
     }
   
     /**
  -   * StreeDOMBuilder instance constructor... it will add the DOM nodes 
  +   * StreeDOMBuilder instance constructor... it will add the DOM nodes
      * to the document fragment.
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param docFrag
      */
     public StreeDOMBuilder(Document doc, DocumentFragment docFrag)
     {
  -    super( doc, docFrag);
  +
  +    super(doc, docFrag);
  +
  +    m_docImpl = (DocumentImpl) doc;
     }
   
     /**
  -   * StreeDOMBuilder instance constructor... it will add the DOM nodes 
  +   * StreeDOMBuilder instance constructor... it will add the DOM nodes
      * to the document.
  +   *
  +   * NEEDSDOC @param doc
      */
     public StreeDOMBuilder(Document doc)
     {
  +
       super(doc);
  +
  +    m_docImpl = (DocumentImpl) doc;
  +  }
  +
  +  /**
  +   * NEEDSDOC Method setIDAttribute 
  +   *
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   * NEEDSDOC @param value
  +   * NEEDSDOC @param elem
  +   */
  +  public void setIDAttribute(String namespaceURI, String qualifiedName,
  +                             String value, Element elem)
  +  {
  +    m_docImpl.setIDAttribute(namespaceURI, qualifiedName, value, elem);
     }
  -  
  -  public void setIDAttribute(String namespaceURI,
  -                             String qualifiedName,
  -                             String value,
  -                             Element elem)
  -  {
  -    ((DocumentImpl)this.getRootNode()).setIDAttribute(namespaceURI,
  -                                                      qualifiedName,
  -                                                      value, elem);
  +
  +  /**
  +   * NEEDSDOC Method characters 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
  +   */
  +  public void characters(char ch[], int start, int length) throws 
SAXException
  +  {
  +
  +    if (m_inCData)
  +      append(new CDATASectionImpl(m_docImpl, ch, start, length));
  +    else
  +      append(new TextImpl(m_docImpl, ch, start, length));
     }
   
  +  /**
  +   * NEEDSDOC Method ignorableWhitespace 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
  +   */
  +  public void ignorableWhitespace(char ch[], int start, int length)
  +          throws SAXException
  +  {
  +    append(new TextImpl(m_docImpl, ch, start, length));
  +  }
  +
  +  /**
  +   * NEEDSDOC Method charactersRaw 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
  +   */
  +  public void charactersRaw(char ch[], int start, int length)
  +          throws SAXException
  +  {
  +
  +    append(m_doc.createProcessingInstruction("xslt-next-is-raw",
  +                                             "formatter-to-dom"));
  +    append(new TextImpl(m_docImpl, ch, start, length));
  +  }
  +
  +  /**
  +   * NEEDSDOC Method comment 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
  +   */
  +  public void comment(char ch[], int start, int length) throws SAXException
  +  {
  +    append(new CommentImpl(m_docImpl, ch, start, length));
  +  }
  +
  +  /**
  +   * NEEDSDOC Method cdata 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
  +   */
  +  public void cdata(char ch[], int start, int length) throws SAXException
  +  {
  +    append(new CDATASectionImpl(m_docImpl, ch, start, length));
  +  }
   }
  
  
  
  1.7       +88 -12    
xml-xalan/java/src/org/apache/xalan/stree/StreeDOMHelper.java
  
  Index: StreeDOMHelper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/StreeDOMHelper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StreeDOMHelper.java       2000/09/11 14:09:16     1.6
  +++ StreeDOMHelper.java       2000/10/30 18:43:54     1.7
  @@ -1,62 +1,138 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.apache.xpath.DOM2Helper;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.Document;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class StreeDOMHelper <needs-comment/>
  + */
   public class StreeDOMHelper extends DOM2Helper
   {
  +
     /**
      * Create an empty DOM Document.  Mainly used for RTFs.
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  +
     // public Document createDocument()
     // {
     //  return new DocumentImpl();
     // }
  -  
     public String getUniqueID(Node node)
     {
  +
       try
       {
  -      int index = ((Child)node).getUid();
  -      return "N"+Integer.toHexString(index);
  +      int index = ((Child) node).getUid();
  +
  +      return "N" + Integer.toHexString(index);
       }
  -    catch(ClassCastException cce)
  +    catch (ClassCastException cce)
       {
         return super.getUniqueID(node);
       }
     }
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Get the depth level of this node in the tree.
  +   *
  +   * NEEDSDOC @param node1
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getLevel(Node node1)
     {
  +
       try
       {
  -      return ((Child)node1).getLevel();
  +      return ((Child) node1).getLevel();
       }
  -    catch(ClassCastException cce)
  +    catch (ClassCastException cce)
       {
         return super.getLevel(node1);
       }
     }
  -  
  +
     /**
      * Tell if the given node is a namespace decl node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isNamespaceNode(Node n)
     {
  +
       try
       {
  -      return ((Child)n).isNamespaceNode();
  +      return ((Child) n).isNamespaceNode();
       }
  -    catch(ClassCastException cce)
  +    catch (ClassCastException cce)
       {
         return super.isNamespaceNode(n);
       }
     }
  -
  -
   }
  
  
  
  1.4       +194 -28   xml-xalan/java/src/org/apache/xalan/stree/TextImpl.java
  
  Index: TextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/stree/TextImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TextImpl.java     2000/10/09 23:25:17     1.3
  +++ TextImpl.java     2000/10/30 18:43:54     1.4
  @@ -1,76 +1,242 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.Text;
   
  -public class TextImpl extends Child implements Text
  +import org.xml.sax.ContentHandler;
  +import org.xml.sax.SAXException;
  +
  +import org.apache.xalan.utils.FastStringBuffer;
  +
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class TextImpl <needs-comment/>
  + */
  +public class TextImpl extends Child implements Text, SaxEventDispatch
   {
  -  private String m_data;
  - 
  -  public TextImpl (DocumentImpl doc, String data)
  +
  +  /** NEEDSDOC Field m_data          */
  +  protected String m_data;
  +
  +  /** NEEDSDOC Field m_start          */
  +  protected int m_start;
  +
  +  /** NEEDSDOC Field m_length          */
  +  protected int m_length;
  +
  +  /**
  +   * Constructor TextImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param data
  +   */
  +  public TextImpl(DocumentImpl doc, String data)
     {
  +
       super(doc);
  +
       m_data = data;
  +    m_length = data.length();
  +    m_start = -1;
     }
   
  -  public TextImpl (DocumentImpl doc, char ch[], int start, int length)
  +  /**
  +   * Constructor TextImpl
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   */
  +  public TextImpl(DocumentImpl doc, char ch[], int start, int length)
     {
  +
       super(doc);
  -    m_data = new String(ch, start, start+length);
  +
  +    // m_data = new String(ch, start, start+length);
  +    FastStringBuffer fsb = doc.m_chars;
  +
  +    m_start = fsb.m_firstFree;
  +    m_length = length;
  +
  +    fsb.append(ch, start, length);
  +  }
  +
  +  /**
  +   * NEEDSDOC Method dispatchSaxEvent 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   *
  +   * @throws SAXException
  +   */
  +  public void dispatchSaxEvent(ContentHandler ch) throws SAXException
  +  {
  +
  +    if (-1 == m_start)
  +      ch.characters(m_data.toCharArray(), 0, m_data.length());
  +    else
  +      ch.characters(m_doc.m_chars.m_map, m_start, m_length);
     }
  -  
  -  /** 
  +
  +  /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() 
  +  public short getNodeType()
     {
       return Node.TEXT_NODE;
     }
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return "#text";
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return "#text";
     }
  -  
  +
     /**
      * Retrieve character data currently stored in this node.
  -   * 
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @throws DOMExcpetion(DOMSTRING_SIZE_ERR) In some implementations,
      * the stored data may exceed the permitted length of strings. If so,
      * getData() will throw this DOMException advising the user to
  -   * instead retrieve the data in chunks via the substring() operation.  
  +   * instead retrieve the data in chunks via the substring() operation.
      */
  -  public String getData() 
  +  public String getData()
     {
  +
  +    if (null == m_data)
  +      m_data = new String(m_doc.m_chars.m_map, m_start, m_length);
  +
       return m_data;
     }
   
  -  /** 
  +  /**
      * Report number of characters currently stored in this node's
  -   * data. It may be 0, meaning that the value is an empty string. 
  +   * data. It may be 0, meaning that the value is an empty string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public int getLength()
  +  {
  +    return m_length;
  +  }
  +
  +  /**
  +   * NEEDSDOC Method getNodeValue 
  +   *
  +   *
  +   * NEEDSDOC (getNodeValue) @return
      */
  -  public int getLength() 
  -  {   
  -    return m_data.length();
  -  }  
  -  
  -  public String getNodeValue() 
  +  public String getNodeValue()
     {
  +
  +    if (null == m_data)
  +      m_data = new String(m_doc.m_chars.m_map, m_start, m_length);
  +
       return m_data;
  -  } // getNodeValue():String
  +  }
   
  +  /**
  +   * NEEDSDOC Method supports 
  +   *
  +   *
  +   * NEEDSDOC @param feature
  +   * NEEDSDOC @param version
  +   *
  +   * NEEDSDOC (supports) @return
  +   */
  +  public boolean supports(String feature, String version)
  +  {
  +
  +    if (feature == SaxEventDispatch.SUPPORTSINTERFACE)
  +      return true;
  +    else
  +      return false;
  +
  +    // else if(feature.equals(SaxEventDispatch.SUPPORTSINTERFACE))
  +    //  return true;
  +    // else
  +    //  return super.supports(feature, version);
  +  }
   }
  
  
  
  1.4       +114 -27   xml-xalan/java/src/org/apache/xalan/stree/WhiteSpace.java
  
  Index: WhiteSpace.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/stree/WhiteSpace.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WhiteSpace.java   2000/10/09 23:25:17     1.3
  +++ WhiteSpace.java   2000/10/30 18:43:54     1.4
  @@ -1,74 +1,161 @@
  +/*
  + * 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.stree;
   
   import org.w3c.dom.Node;
   
   /**
  - * Right now this is the same as TextImpl.  Not sure what I 
  - * want to do with this, but it certainly seems like there 
  - * should be some way to optimize the storage of whitespace 
  + * Right now this is the same as TextImpl.  Not sure what I
  + * want to do with this, but it certainly seems like there
  + * should be some way to optimize the storage of whitespace
    * nodes.
    */
   public class WhiteSpace extends Child
   {
  +
  +  /** NEEDSDOC Field m_data          */
     String m_data;
  -  
  -  public WhiteSpace (DocumentImpl doc, char ch[], int start, int length)
  +
  +  /**
  +   * Constructor WhiteSpace
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   */
  +  public WhiteSpace(DocumentImpl doc, char ch[], int start, int length)
     {
  +
       super(doc);
  -    m_data = new String(ch, start, start+length);
  +
  +    m_data = new String(ch, start, start + length);
     }
  -  
  -  /** 
  +
  +  /**
      * A short integer indicating what type of node this is. The named
      * constants for this value are defined in the org.w3c.dom.Node interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public short getNodeType() 
  +  public short getNodeType()
     {
       return Node.TEXT_NODE;
     }
   
  -  /** Returns the node name. */
  -  public String getNodeName() 
  +  /**
  +   * Returns the node name. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNodeName()
     {
       return "#text";
     }
  -  
  +
     /**
      * Returns the local part of the qualified name of this node.
  -   * <br>For nodes created with a DOM Level 1 method, such as 
  -   * <code>createElement</code> from the <code>Document</code> interface, 
  +   * <br>For nodes created with a DOM Level 1 method, such as
  +   * <code>createElement</code> from the <code>Document</code> interface,
      * it is <code>null</code>.
      * @since DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return "#text";
     }
  -  
  +
     /**
      * Retrieve character data currently stored in this node.
  -   * 
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @throws DOMExcpetion(DOMSTRING_SIZE_ERR) In some implementations,
      * the stored data may exceed the permitted length of strings. If so,
      * getData() will throw this DOMException advising the user to
  -   * instead retrieve the data in chunks via the substring() operation.  
  +   * instead retrieve the data in chunks via the substring() operation.
      */
  -  public String getData() 
  +  public String getData()
     {
       return m_data;
     }
   
  -  /** 
  +  /**
      * Report number of characters currently stored in this node's
  -   * data. It may be 0, meaning that the value is an empty string. 
  +   * data. It may be 0, meaning that the value is an empty string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public int getLength() 
  -  {   
  +  public int getLength()
  +  {
       return m_data.length();
  -  }  
  -  
  -  public String getNodeValue() 
  +  }
  +
  +  /**
  +   * NEEDSDOC Method getNodeValue 
  +   *
  +   *
  +   * NEEDSDOC (getNodeValue) @return
  +   */
  +  public String getNodeValue()
     {
       return m_data;
  -  } // getNodeValue():String
  +  }  // getNodeValue():String
   }
  
  
  
  1.1                  
xml-xalan/java/src/org/apache/xalan/stree/SaxEventDispatch.java
  
  Index: SaxEventDispatch.java
  ===================================================================
  /*
   * 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, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.xalan.stree;
  
  import org.xml.sax.ContentHandler;
  import org.xml.sax.SAXException;
  
  /**
   * This class allows a node to implement an interface that will
   * allow it to dispatch a SAX ContentHandler event to a ContentHandler.
   * This is especially useful in those cases where you want the
   * node to be able to dispatch a character event, but don't want
   * to cause it to make a string.
   */
  public interface SaxEventDispatch
  {
    /** The URL to pass to the Node#supports method, to see if the 
     * node supports this interface. */
    public static final String SUPPORTSINTERFACE =
      "http://xml.apache.org/xalan/features/feed-events";;
  
    /**
     * If a node supports this interface, it can directly call an 
     * appropriate method on the passed ContentHandler.  For instance, 
     * a text node will call the characters method.  This is for 
     * optimization purposes, when the node may have information not 
     * easily accessible, which it can pass directly to the sax event. 
     * For instance, the text node may be able to directly pass a 
     * char array, and thus not have to create a String object 
     * at all.
     *
     * @param ch A non-null reference to a ContentHandler.
     *
     * @throws SAXException
     */
    public void dispatchSaxEvent(ContentHandler ch) throws SAXException;
  }
  
  
  

Reply via email to