public static void main(String[] args) {
try {
URL u = new URL("http://www.ibiblio.org/xml/examples/shakespeare/much_ado.xml");
Document doc = new SAXBuilder().build(u);
JDOMXPath xpath = new JDOMXPath("PLAY/ACT/SCENE/SPEECH/SPEAKER");
long start = System.currentTimeMillis();
int count = 0;
for (int i = 0; i < 1000; i++) {
Element speaker = (Element) xpath.selectSingleNode(doc);
count += (speaker == null ? 0 : 1);
}
long end = System.currentTimeMillis();
System.out.println((end - start));