I have the following xml file:
There are many ways. One is to do JDOM and xpath. Something like this (from this article: http://onjava.com/onjava/2005/01/12/xpath.html):
SAXBuilder saxBuilder =
new SAXBuilder("org.apache.xerces.parsers.SAXParser");
org.jdom.Document jdomDocument =
saxBuilder.build(new File("somefile");
org.jdom.Attribute levelNode =
(org.jdom.Attribute)(XPath.selectSingleNode(
jdomDocument,
"/resources/resource[@id='res003']/property[@name='propF']/@value"));
System.out.println(levelNode.getValue());
Did not test it, but should work. For xpath tutorial see http://zvon.org/xxl/XPathTutorial/General/examples.html . Its the best and fastest tutorial.
Take care about the saxbuilder lifecycle, if it is called often.