西西软件园多重安全检测下载网站、值得信赖的软件下载站!
西西首页 常用软件 软件下载 安卓软件 游戏下载 安卓游戏 MAC应用 驱动下载 安卓电视
系统工具网络工具媒体工具图形图像聊天工具应用软件编程开发手机软件安卓应用电脑安全字体素材

jdom jar

  • jdom jar
  • 软件大小:142KB
  • 更新时间:2014-06-17 15:11
  • 软件语言:中文
  • 软件厂商:
  • 软件类别:国产软件 / 免费软件 / 编程辅助
  • 软件等级:4级
  • 应用平台:WinAll, Win7
  • 官方网站:http://www.cr173.com
好评:50%
坏评:50%

装机必备软件

软件介绍

不用是你的损失!这么好用的包

本Jive(Jdon版)可在Jbuilder 7直接打开。

建议你用Jbuilder7打开后,编辑相应设置(JDK1.4)

本软件在linux+jdk1.4+tomcat 4以上环境运行正常,中文显示正常。

用法:

依赖于jar包: dom4j.jar 和 jaxen-1.1.1.jar 
Xml代码  
1. <?xml version="1.0" encoding="UTF-8"?>  
2. <list>  
3. <index>D:\\index\\IndexDB</index>  
4. </list>  

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. }  

软件标签: jar

软件截图

jdom jar

    其他版本下载

    热门评论

    最新评论

    第 1 楼 美国CZ88.NET 网友 客人 发表于: 2016/1/8 13:15:10
    挺好用的,多谢了

    支持( 0 ) 盖楼(回复)

    发表评论 查看所有评论(1)

    昵称:
    表情: 高兴 可 汗 我不要 害羞 好 下下下 送花 屎 亲亲
    字数: 0/500 (您的评论需要经过审核才能显示)

    下载帮助下载帮助西西破解版软件均来自互联网, 如有侵犯您的版权, 请与我们联系。

    TOP
    软件下载