I received a bunch of emails asking me to make a tutorial on Java XPath. I guess you liked my previous XML XPath tutorial?
XPath can be used to easily grab data from an XML file and into your Java code. I’ll cover how to write to an XML file the easy way in my next tutorial on JDOM2.
All of the code follows the video, and it is heavily commented to help you learn.
If you like videos like this, please tell Google [googleplusone]
I always appreciate sharing [nttfblike]
Code from the Video
JAVALESSON45.JAVA
XML FILE USED
i would like to have compare two xmls which is having the namespace.
Please explain how we can do it.
Thanks,
Chandra
That shouldn’t really happen ever if proper namespaces are defined
I am not able to rad this xml
WFS
1212503
OMNISALE
1
ZONA1
30/04/2008
can you please help me on this
That is because your xml does not have any elements.
Nice video. I got a problem to run the same code and same XML file on my mac. I have not made any changes. I installed Java JDK 1.7 as shown here (http://www.newthinktank.com/2011/12/install-java-1-7-eclipse/). I’m very sure from the correct file path. Although that, I got this error:
java.io.FileNotFoundException: /Users/follower/myXPath/src/tvshows5.dtd (No such file or directory)
Keep all of your files in the same folder and you won’t have any problems. It is recommended to save in src – default package for your project in Eclipse
Just delete
line from xml file..
and run it
thx dude, i really need this!!
You’re very welcome 🙂