1 46 package org.jaxen.xom; 47 48 import nu.xom.Document; 49 import nu.xom.Element; 50 import nu.xom.Builder; 51 52 class Performance { 53 54 public static void main(String [] args) { 55 56 try { 57 Document doc = new Builder().build("http://www.ibiblio.org/xml/examples/shakespeare/much_ado.xml"); 58 XOMXPath xpath = new XOMXPath("PLAY/ACT/SCENE/SPEECH/SPEAKER"); 59 60 long start = System.currentTimeMillis(); 61 62 int count = 0; 63 for (int i = 0; i < 1000; i++) { 64 Element speaker = (Element) xpath.selectSingleNode(doc); 65 count += (speaker == null ? 0 : 1); 66 } 67 68 long end = System.currentTimeMillis(); 69 System.out.println((end - start)); 70 System.out.println(count); 71 72 } catch (Exception ex) { 73 ex.printStackTrace(); 74 } 75 } 76 77 } 78 | Popular Tags |