On top of javax.xml.xpath
Bundled with Java 1.5; a standard extension for Java 1.4 and earlier
There are other frameworks you could use
import org.xml.sax.InputSource;
import javax.xml.xpath.*;
import junit.framework.*;
import java.io.*;
public class PListXPathTest extends TestCase {
private InputSource plist;
private XPath query;
protected void setUp() throws IOException {
plist = new InputSource(new FileInputStream("thunderbirdplist.xml"));
query = XPathFactory.newInstance().newXPath();
}
public void testNoTwoKeyElementsAreAdjacent()
throws XPathExpressionException {
// //key/following-sibling::*[1]/self::key is empty
Boolean result = (Boolean) query.evaluate(
"//key/following-sibling::*[1]/self::key",
plist, XPathConstants.BOOLEAN);
assertFalse(result.booleanValue());
}
}