You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@daedelus.apache.org on 2000/12/31 10:50:22 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/stree DocumentImpl.java

sboag       00/12/31 01:50:21

  Modified:    java/src/org/apache/xalan/stree DocumentImpl.java
  Log:
  DocumentImpl#appendChild now checks to see if it
  is a DOCUMENT_FRAGMENT_NODE before complaining about
  multiple roots being added.
  Add 100 ms wait so that posted exceptions can be checked
  periodically.
  
  Revision  Changes    Path
  1.14      +17 -14    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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DocumentImpl.java	2000/12/15 03:59:06	1.13
  +++ DocumentImpl.java	2000/12/31 09:50:21	1.14
  @@ -204,19 +204,22 @@
     public Node appendChild(Node newChild) throws DOMException
     {
   
  -    short type = newChild.getNodeType();
  -
  -    if (type == Node.ELEMENT_NODE)
  -    {
  -      if (null != m_docElement)
  -        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
  -                               "DOM006 Hierarchy request error");
  -
  -      m_docElement = (ElementImpl) newChild;
  -    }
  -    else if (type == Node.DOCUMENT_TYPE_NODE)
  +    if(getNodeType() != Node.DOCUMENT_FRAGMENT_NODE)
       {
  -      m_docType = (DocumentTypeImpl) newChild;
  +      short type = newChild.getNodeType();
  +  
  +      if (type == Node.ELEMENT_NODE)
  +      {
  +        if (null != m_docElement)
  +          throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
  +                                 "DOM006 Hierarchy request error");
  +  
  +        m_docElement = (ElementImpl) newChild;
  +      }
  +      else if (type == Node.DOCUMENT_TYPE_NODE)
  +      {
  +        m_docType = (DocumentTypeImpl) newChild;
  +      }
       }
   
       return super.appendChild(newChild);
  @@ -277,7 +280,7 @@
      */
     public DocumentFragment createDocumentFragment()
     {
  -    return new DocumentFragmentImpl(this);
  +    return new DocumentFragmentImpl();
     }
   
     /**
  @@ -421,7 +424,7 @@
             // but we seem to come out of wait() too soon! 
             while (!isComplete())
             {
  -            m_doc.wait();
  +            m_doc.wait(100);
               throwIfParseError();
   
               elem = (Element) m_idAttributes.get(elementId);