Question

I program in Java and I'm using a DOM parser.

I noticed that there is a difference between

org.w3c.dom.Node 

and

Node

but i don't know what that difference is.

I figured that out when i tried to call a method which had an argument of type: org.w3c.dom.Node .

I entered a Node argument and i took the following error:

    Exception in thread "main" java.lang.ClassCastException: 
    com.sun.org.apache.xerces.internal.dom.DeferredTextImpl cannot be cast to javax.xml.soap.Node
at elementchildren.ElementChildren.main(ElementChildren.java:50)
Java Result: 1 

May you please help me?

Was it helpful?

Solution

It looks to me like you've accidentally used

import javax.xml.soap.Node;

instead of

import org.w3c.dom.Node;

A DeferredTextImpl instance implements the latter, not the former.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top