You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Michael Glavassevich <mr...@ca.ibm.com> on 2006/10/09 18:48:07 UTC
Re: java.lang.ClassCastException when adopting Node
"Sergey Vidyuk" <sv...@gmail.com> wrote on 10/09/2006 12:25:50 PM:
> Yes. xercesImpl.jar in folder WEB-INF/lib/ has version 2.8.1.
> Should i move it to endorsed folder of tomcat?
That sounds like the right thing to do.
> Thanks for response.
>
> Sergey
>
> On 10/9/06, Michael Glavassevich <mr...@ca.ibm.com> wrote:
> > 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@georgetown.edu%3e
> > [2] http://issues.apache.org/jira/browse/XERCESJ-1106
> >
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: mrglavas@ca.ibm.com
> > E-mail: mrglavas@apache.org
> >
> > "Sergey Vidyuk" <sv...@gmail.com> 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@xerces.apache.org
> > > For additional commands, e-mail: j-dev-help@xerces.apache.org
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org