email@example.com hi, i am facing a problem in parsing xml file in java by using DOM parser. my input xml file is: <?xml version="1.0" ?> <links> <link1> <name>abc</name> <val>123</val> </link1> <link2> <name>xyz</name> <val>456</val> </link2> </links>
org.apache.crimson.jaxp.DocumentBuilderImpl@fabe9 At creation org.apache.crimson.tree.XmlDocument@1888759 At Parsing links Root element 5 No of childs #text Node element java.lang.NullPointerException at xmlparse.main(xmlparse.java:27) Exception in thread "main"
in my xml file the root tag (<links>) contains 2 child tags (<link1>,<link2>) but the output of my java prog is showing 5 child tags. please tell me why my java prog is behaving like this and provide me the solution.
There is a VERY handy table in org.w3c.dom.Node JavaDocs that shows what every kind of Node responds with for the various methods. There you will see that many types of Node have a nodeValue of null, including Element nodes. Bill
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com