DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25608>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25608

DOMResult(Node) fails for Element when transform outputs more than one root node.





------- Additional Comments From [EMAIL PROTECTED]  2003-12-18 01:32 -------
I believe the problem is in org.apache.xml.utils.DOMBuilder. When the first 
element is ended in endElement the m_elementStack.pop() leaves an empty stack 
and m_currentNode is set to null. The next time startElement is called it 
attempts to append a new node, but the m_currentNode is null and thus throws an 
exception because it is not building a DocumentFragment and an existing node 
has been appended. 

The fix seems to be to change the constructor so that it adds the passed Node 
to the m_elementStack, if it is an Element.


  /**
   * DOMBuilder instance constructor... it will add the DOM nodes
   * to the passed node.
   *
   * @param doc Root document
   * @param node Current node
   */
  public DOMBuilder(Document doc, Node node)
  {
    m_doc = doc;
    m_currentNode = node;
    if ( node.getNodeType() == Node.ELEMENT_NODE ) {
        m_elemStack.push(node);
    }
  }

Reply via email to