I am new in xml .Actually i am trying to build DOM Object of a file whose path is given .So that it can be used in display ,edit, traverse functions...
Problem is that variable doc is getting a null value.Why is it so?
Execute the code and share the output/errors if any....
Joined: Apr 10, 2012
Santhosh ayiappan wrote:Execute the code and share the output/errors if any....
When I run this code I got this error.
run: Exception in thread "main" java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl cannot be cast to javax.swing.text.Document at common.parseXmlFile.parseXmlFile(parseXmlFile.java:28) at common.parseXmlFile.main(parseXmlFile.java:59) Java Result: 1
s ithu wrote:Problem is that variable doc is getting a null value.Why is it so?
That is simply because the "value" of a Document node is null. Check out the API documentation of org.w3c.dom.Node to confirm that. But you aren't going to be using the "value" of the Document node anyway, so there is no need to spend any time worrying about it. It isn't a problem.