-
-
jdom jar
PC版
- 软件大小:0.14MB
- 更新日期:2018-04-11
- 下载次数:0次
- 软件语言:简体中文
- 软件授权:免费软件
- 软件评级:

- 安全检测:无插件无病毒
- 软件类型:国产软件
- 软件分类:编程控件
- 软件系统:Win All
jdom jar简介
不用是你的损失!这么好用的包
本Jive(Jdon版)可在Jbuilder 7直接打开。
建议你用Jbuilder7打开后,编辑相应设置(JDK1.4)
本软件在linux+jdk1.4+tomcat 4以上环境运行正常,中文显示正常。
用法:
依赖于jar包: dom4j.jar 和 jaxen-1.1.1.jar
Xml代码
1.
2.
3.
4.
Java代码
1. package com.wlh.dom4j.test;
2.
3. import org.dom4j.Document;
4. import org.dom4j.DocumentException;
5. import org.dom4j.Node;
6. import org.dom4j.io.SAXReader;
7.
8. public class TestReader {
9. public static void main(String args[]){
10. String filePath="index.xml";
11. try {
12. //如果配置文件是在Src下,则采用如下方式得到Document
13. Document document=new SAXReader().read(Thread.currentThread().getContextClassLoader().getResourceAsStream(filePath));
14. //如果配置文件是在本地文件系统,则采用如下方式得到Document
15. //Document document=new SAXReader().read("D:index.xml");
16. if (document == null) {
17. System.out.println(filePath+"没找到");
18. }else{
19. Node node=document.selectSingleNode("//list/index");
20. String indexfile=node.getText();
21. System.out.println(indexfile);
22. }
23. } catch (DocumentException e) {
24. e.printStackTrace();
25.
26. }
27. }
28. }
jdom读取xml文件:
依赖于jar包: jdom.jar
得到URL的方式:Thread.currentThread().getContextClassLoader().getResource(filePath)
Java代码
1. package com.wlh.dom4j.test;
2.
3. import java.io.IOException;
4. import java.util.List;
5.
6. import org.jdom.Document;
7. import org.jdom.Element;
8. import org.jdom.JDOMException;
9. import org.jdom.input.SAXBuilder;
10.
11. public class TestJdomReader {
12. public static void main(String args[]) {
13. String filePath = "zxt_index.xml";
14. String indexPath="";
15. SAXBuilder builder = new SAXBuilder(false);
16. try {
17. Document doc = builder.build(Thread.currentThread().getContextClassLoader().getResource(filePath));
18. Element books = doc.getRootElement();
19. Element rootElement= books.getChild("list");
20. Element index=rootElement.getChild("index");
21. indexPath=index.getText();
22. System.out.println(indexPath);
23. } catch (JDOMException e) {
24. e.printStackTrace();
25. } catch (IOException e) {
26. e.printStackTrace();
27. }
28.
29. }
30. }
相关专题
换一换人气软件
-
红手指云手机v4.12.081
237.76 MB|2026-01-27
-
抖音电脑版7.1.0
4.58 MB|2026-01-20
-
雷神加速器11.3.0.8
88.3MB|2026-01-16
-
360软件管家13.0.0.2007
95.2MB|2026-01-16
-
泡泡加速器25.12.5.1
2.92 MB|2026-01-16
-
虎牙直播7.30.0.120
2.79 MB|2026-01-13
- 51热搜
- 热门分类
- 热门专题
热搜推荐
-
租号玩5.18.250612.1
|91.5MB -
我的世界1.18.24.12
|180.14 MB -
快手13.11.40.45972
|95.42MB -
乐播投屏6.3.50
|120 MB -
爱奇艺13.11.0.9633
|67.38MB
装机必备软件
小编推荐
-
1
红手指云手机v4.12.081
游戏软件|
-
2
抖音电脑版7.1.0
视频播放|
-
3
雷神加速器11.3.0.8
网络加速|
-
4
360软件管家13.0.0.2007
系统安全|
-
5
泡泡加速器25.12.5.1
网络加速|
-
6
虎牙直播7.30.0.120
视频播放|
-
7
迅游网游加速器8.0
网络加速|
-
8
苹果恢复大师3.8.38.2362最新版
数据恢复|
-
9
驱动精灵2025.8.5.220
硬件工具|
-
10
得力OCR文字识别3.1.0.5 官方版
办公软件|
最新软件
-
Postman
0.14MB/2018-04-11
-
萤石云视频
0.14MB/2018-04-11
-
vcredist_x64.exe
0.14MB/2018-04-11
-
themida
0.14MB/2018-04-11
-
Hex Workshop(十六进制编辑工具)
0.14MB/2018-04-11
-
WPE中文专业版
0.14MB/2018-04-11


