Hi,
I am trying to figure out how to make a complete copy of a DOM document. I am using xerces but vanilla DOM would obviously be the best solution. The nearest I have got is something like:
Document newDoc = new DocumentImpl;
newDoc.appendChild(newDoc.importNode(oldDoc.getDocumentElement,true));
but I presume this won't do namespace declarations, processing instructions, the <?xml> declaration at the front etc etc.
I would have thought this would be a FAQ but I can't find anything obvious anywhere.
many thanks
Andy
I am trying to figure out how to make a complete copy of a DOM document. I am using xerces but vanilla DOM would obviously be the best solution. The nearest I have got is something like:
Document newDoc = new DocumentImpl;
newDoc.appendChild(newDoc.importNode(oldDoc.getDocumentElement,true));
but I presume this won't do namespace declarations, processing instructions, the <?xml> declaration at the front etc etc.
I would have thought this would be a FAQ but I can't find anything obvious anywhere.
many thanks
Andy