dom4j 解析。xml SAXReader的read方法读取
来源:互联网 发布:gps监控数据统计分析 编辑:程序博客网 时间:2024/06/05 11:26
具体详见,,,File IO 读写文件,
3.利用dom4j读取xml文件 /** *//**从目录中读取xml文件 * @param path 文件目录 * @return * @throws DocumentException * @throws IOException */ public Document readXml(String path) throws DocumentException, IOException...{ File file=new File(path); BufferedReader bufferedreader = new BufferedReader(new FileReader(file)); SAXReader saxreader = new SAXReader(); Document document = (Document)saxreader.read(bufferedreader); bufferedreader.close(); return document; }
2009-07-30 22:34hello冷风 | 分类:网站使用 | 浏览5064次
我还想问一下Document对象中是不是存在一系列的引用指向其子节点,谢谢
提问者采纳
检举| 2009-08-11 09:14
String xmlAddress = "./aaa.xml";SAXReader reader = new SAXReader();File xmlFile = new File(xmlAddress);Document document = reader.read(xmlFile);这里用FILE方式读取,其实用URL是一样的------------------------------------------用dom4j就要用XPath,索引节点非常方便这里的XPathExpression就是类似"/root/element/element"的字符串具体表达式的应用去看下XPath教程就行,入手很容易//返回符合表达式的节点LISTList list = document.selectNodes(XPathExpression);//返回符合表达式的一个节点Node node = document.selectSingleNode(XPathExpression);
- dom4j 解析。xml SAXReader的read方法读取
- xml--dom4j SAXReader解析
- DOM4j SAXReader 读取XML文件
- 用dom4j 修改xml文档 saxreader read
- DOM4j解析xml文件(SaxReader方法),并抽象实体类
- Java生成和解析XML格式文件和字符串的实例代码【dom4j中的SAXReader对象读取并解析xml文件】
- java解析XML saxReader.read(xml) 错误:org.dom4j.DocumentException: no protocol
- java解析XML saxReader.read(xml) 错误:org.dom4j.DocumentException: no protocol
- 采用DOM4J中的SAXReader解析webservice返回的XML文件
- java--DOM4j-SAXReader对xml文档的解析2
- java--DOM4j-SAXReader对xml文档的解析2
- DOM4j读取XML文件(SAXReader)
- DOM4j读取XML文件(SAXReader)
- DOM4j读取XML文件(SAXReader)
- dom4j中SAXReader读取xml文件
- JDOM、DOM4j读取XML文件(SAXReader)
- DOM4j读取XML文件(SAXReader)
- 使用Dom4j解析xml文件---SAXReader方式
- JavaScript设置IFrame高度自适应(兼容多浏览器)
- Add two numbers without using arithmetic operators
- C++中this指针的用法
- 2013.6.9
- jsp中几种重定向
- dom4j 解析。xml SAXReader的read方法读取
- Qt C++ Iterator模式
- MyEclipse 启动tomcat,报错 Unknown database 'database'
- 如何在android 中获取Wifi设备的IP地址
- jQuery插件编写:Why use the Widget Factory(四)
- STC-ISP Win8下载不进程序 profile usb-to-serial comm port驱动
- Swap bits in a given number
- nfs挂载文件系统设置及使用
- USB和sysfs文件系统