java.lang.ClassCastException when adopting Node 2006-10-09 - By Michael Glavassevich
Are you sure you were using Xerces 2.8.1 when you tried this? This looks identical to a bug [1][2] that was reported last year and fixed in Xerces 2.8.0. The test which was attached to that bug report still works for me.
[1] http://mail-archives.apache.org/mod_mbox/xerces-j-users/200510.mbox/%3c4357AFBC .30809@(protected)%3e [2] http://issues.apache.org/jira/browse/XERCESJ-1106
Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: mrglavas@(protected) E-mail: mrglavas@(protected)
"Sergey Vidyuk" <svidyuk@(protected)> wrote on 10/09/2006 11:23:41 AM:
> When trying to adopt node after parsing > public static Node parseString(Document doc, String content) > throws Exception > StringReader contentReader = new StringReader(content); > InputSource source = new InputSource(contentReader); > DocumentBuilder b = XMLTools.get(false, false); > Document sourceDoc = b.parse(source); > XMLTools.release(b, false, false); > Node root = sourceDoc.getFirstChild(); > Node imported = doc.adoptNode(root); > if (imported == null) { > System.out.println("not adopted"); > imported = doc.importNode(root, true); > } > return imported; > } > > > folowing error occur: > java.lang.ClassCastException: org.apache.xerces.dom.DocumentImpl > at org.apache.xerces.dom.DeferredAttrImpl.synchronizeChildren(Unknown > Source) > at org.apache.xerces.dom.AttrImpl.setOwnerDocument(Unknown Source) > at org.apache.xerces.dom.NamedNodeMapImpl.setOwnerDocument(Unknown > Source) > at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source) > at org.apache.xerces.dom.ParentNode.setOwnerDocument(Unknown Source) > at org.apache.xerces.dom.ElementImpl.setOwnerDocument(Unknown Source) > at org.apache.xerces.dom.CoreDocumentImpl.adoptNode(Unknown Source) > > > Java: JDK 1.5.0_08 Xerces 2.8.1 > > What I do wrong? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-dev-unsubscribe@(protected) > For additional commands, e-mail: j-dev-help@(protected)
--------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscribe@(protected) For additional commands, e-mail: j-dev-help@(protected)
|
|