分类: Java
2007-06-13 19:48:19
package com.test; import java.io.*; import java.util.*; import org.dom4j.*; import org.dom4j.io.*; public class MyXMLReader { public static void main(String arge[]) { long lasting = System.currentTimeMillis(); try { File f = new File("data_10k.xml"); SAXReader reader = new SAXReader(); Document doc = reader.read(f); Element root = doc.getRootElement(); Element foo; for (Iterator i = root.elementIterator("VALUE"); i.hasNext();) { foo = (Element) i.next(); System.out.print("车牌号码:" + foo.elementText("NO")); System.out.println(" 车主地址:" + foo.elementText("ADDR")); } } catch (Exception e) { e.printStackTrace(); } System.out.println("运行时间:" + (System.currentTimeMillis() - lasting) + " 毫秒"); } } |
10k消耗时间:109 78 109 31
100k消耗时间:297 359 172 312
1000k消耗时间:2281 2359 2344 2469
10000k消耗时间:20938 19922 20031 21078