Andy Clark wrote: > > Michael Gratton wrote: > > After parsing an XML document and performing a cloneNode(true) on the > > resulting org.w3c.dom.Document object, I get a clone of the DOM tree, as > > I'd expect. However, if I then do a getChildNodes() to any node in the > > tree, it seems that the Node's children are completely lost, although > > the NodeList seems to work fine. > > > > For example, if I call getChildNodes() on the Document itself, it > > suddenly has no document element. > > I've tried to duplicate your problem but to no avail. The attached > sample code works perfectly fine using both Xerces-J 1.0.3 and what > is currently in CVS. Do you have a test case that fails?
I've modified your sample. It looks like it's independent of cloneNode() (sorry about that, I never tried it on a fresh parsed Document before now). If you run the sample, both the original and cloned Documents "lose" their children between the consecutive printNode passes. I tested it against Xerces-J 1.0.3 and 1.0.2 which both failed to output the children and against 1.0.1 which seemed to work fine, but not against the CVS version. Thanks, Michael. -- ? Michael Gratton - [EMAIL PROTECTED] ! "Scientific progress goes 'boink'?" > http://web.vee.net/
CloneDocument.java
Description: Binary data