首页>代码>java使用dom4j读取xml示例>/dom4j读取xml/XmlRead.java
package xmlRead;

import java.io.File;
import java.util.Iterator;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class XmlRead {

	public static void main(String[] args) {
		try {
		File f = new File("C:\\Users\\Administrator\\Desktop\\testForRead.xml");
		SAXReader reader = new SAXReader();
		Document document = reader.read(f);
		//获取根节点元素
		Element element = document.getRootElement();
		//列出根节点
		Utils utils = new Utils();
//		utils.listElement(element);
//		System.out.println("遍历所有节点结束====================================================\r\n");
		
		
		//取出
		utils.getElements(element);
		
		utils.getAllElements(element);
		}catch (DocumentException e) {
			
			e.printStackTrace();
		}
	}

	
}
最近下载更多
sipm123  LV1 2023年3月5日
3969138  LV15 2019年9月19日
kld113  LV20 2019年3月5日
18170035580  LV14 2017年12月19日
放开那女孩  LV15 2017年9月20日
爷爷在此  LV16 2017年8月28日
精诚忆  LV12 2017年5月24日
fxhh5057  LV13 2017年5月12日
javaggm  LV13 2017年4月20日
dane168  LV2 2017年3月18日
最近浏览更多
sipm123  LV1 2023年3月5日
yuzhiyuan1977  LV2 2021年8月2日
499600644  LV1 2021年5月11日
maki666  LV1 2021年4月15日
shiopaaa  LV13 2021年4月9日
abcabcabca  LV3 2021年2月1日
15939671505 2020年12月18日
暂无贡献等级
h012345678  LV8 2020年12月15日
liuguojun920  LV6 2020年9月9日
yy0987  LV5 2020年8月23日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友