I have used org.w3c.dom.Node.getTextContent() metthod to get the text value, the same is working fine in Eclipse. When we run it as stanalone, it is taking :class org.apache.xerces.dom.DeferredElementImpl and failing. Please advice on how to get org.w3c.dom.Node.getTextContent() at runtime.
I have used org.w3c.dom.Node.getTextContent() metthod to get the text value, the same is working
Share
org.w3c.dom.Nodeis an interface.org.apache.xerces.dom.DeferredElementImplis an implementation of that interface (really, an implementation oforg.w3c.dom.Element, a subinterface ofNode). There are other implementations. If you write a program that usesNode, then when you run it, you will actually be using one of the implementations.It seems that
DeferredElementImpldoes not implementgetTextContent()properly. Although it’s hard to be sure of that, given that you haven’t said what the actual problem was.It seems that in Eclipse, you are using some implementation other than
DeferredElementImpl, and that implementation implementsgetTextContent()properly. On my installation of Eclipse, i get acom.sun.org.apache.xerces.internal.dom.ElementImplif i create an element in the normal way.com.sun.org.apache.xerces.internal.dom.ElementImplis the standard implementation bundled in the Sun JRE. If you are getting a different implementation, it is because you have a non-standard XML parser on your classpath. That is perfectly fine, but it’s something you should be aware of. If you examine your standalone application’s classpath, you should find a parser that isn’t there when you run in Eclipse.