爷的眼睛闪亮
insideDotNet En_summerGarden

package com.sun.test;

import java.io.*;
import java.util.*;
import org.dom4j.*;
import org.dom4j.io.*;

public class Dom4jAnalysis {
public static void main(String arge[]) {
long lasting = System.currentTimeMillis();
try {
File f = new File("C:\\Users\\xsp034\\Desktop\\dom4j.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();
}
}
}

 

 

posted on 2016-12-12 10:15  爷的眼睛闪亮  阅读(144)  评论(0编辑  收藏  举报