You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Prakash Sridharan <PS...@selectica.com> on 2003/01/30 11:52:24 UTC

DOM005 Wrong Document Error during transformation

Hi All,
 
In my project, I am merging 2 W3C Documents and getting a single W3C
Dcoument and then doing transformation on the merged document. Sometimes I
am getting javax.xml.transform.TransformerException:
org.w3c.dom.DOMException: DOM005 Wrong document
The code is shown below.
//merging documents
public Document merge(String mergeName, Document doc1, Document doc2)
{
Document document = new org.apache.xerces.dom.DocumentImpl();
Element rootNode = document.createElement(mergeName);
 
rootNode.appendChild(doc1.getDocumentElement());
rootNode.appendChild(doc2.getDocumentElement());
 
document.appendChild(rootNode);
return document;
}
 
//transformation
transform(Document doc, String fileName)
{
javax.xml.transform.stream.StreamSource streamSource = new
javax.xml.transform.stream.StreamSource(new File(fileName));
javax.xml.transform.Templates templates =
TransformerFactory.newInstance().newTemplates(streamSource);
templates.newTransformer().transform(new DOMSource(doc), result);
}
Can anybody help me what could cause this error?
 
 
Thanks in advance,
Prakash

Re: DOM005 Wrong Document Error during transformation

Posted by Joseph Kesselman <ke...@us.ibm.com>.
Not a Xalan question. See http://www.w3.org/DOM/faq.html#ownerdoc
______________________________________
Joe Kesselman  / IBM Research