You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Minnie Haridasa <mi...@corp.earthlink.net> on 2005/03/28 22:22:11 UTC
ImportNode.. -Please help
I thought you may have a pointer or two regards to a strange issue.
We have a need to combine individual DOM into a single DOM and to do that I
use import node. I am creating a DOM from the InputStream..
java.io.InputStreamReader ir = new
java.io.InputStreamReader(in,"UTF-8");
org.xml.sax.InputSource inputSource = new
org.xml.sax.InputSource(new java.io.BufferedReader(ir));
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(inputSource);
At the point where we combine the nodes, we get the root node from the
original DOM and attach it to the NEW DOM
Element root= document.getDocumentElement();
....
dup = finalDocument.importNode(root, true);
but I get..
org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML
character is specified.
at org.apache.xerces.dom.CoreDocumentImpl.createElement(Unknown
Source)
at org.apache.xerces.dom.CoreDocumentImpl.importNode(Unknown Source)
How can I know what character the import node is complaining about ?
How can I make sure that the XML data I receive from the 3rd party does not
contain invalid XML data ?
Any pointers are greatly appreciated
Thanks
MH