xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Dodd <AnthonyD...@synergy-fs.com>
Subject RE: Changing owner document
Date Mon, 15 May 2000 15:11:11 GMT
Hi Steve
  Use the new DOM 2 oeg.w3c.dom.Document.importNode() method.
Regards
Tony

-----Original Message-----
From: Steve Chervitz [mailto:sac@neomorphic.com]
Sent: 13 May 2000 00:57
To: general@xml.apache.org
Subject: Changing owner document 


I recently started using Xerces-J coming from XML4J and have run into
the following snag. I want to take a node from one document and add it
to a node on a different document. Using XML4J, this is what I would
do:

    // aDoc and anotherDoc are different DocumentImpl objects

    Node foo = aDoc.removeChild(
                        aDoc.getElementsByTagName("foo").item(0));
        
    Node bar = anotherDoc.getElementsByTagName("bar").item(0);

    bar.appendChild(foo);

When I do this I get the following error:

  org.apache.xerces.dom.DOMExceptionImpl: DOM005 Wrong document

How do I change the owner document for a node? 

Thanks,
Steve

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org

Mime
View raw message