当前位置:编程学习 > JAVA >>

java 读取XML文件 xml文件内容如下

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.knime.org/2008/09/XMLConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.knime.org/2008/09/XMLConfig http://www.knime.org/XMLConfig_2008_09.xsd" key="settings.xml">
<entry key="name" type="xstring" value="File Reader"/>
<config key="model">
<config key="Delimiters">
<config key="Delim0">
<entry key="pattern" type="xstring" value="%%00010"/>
<entry key="combineMultiple" type="xboolean" value="true"/>
<entry key="includeInToken" type="xboolean" value="false"/>
<entry key="returnAsToken" type="xboolean" value="true"/>
</config>

</config>

<entry key="hasContent" type="xboolean" value="true"/>

<entry key="isInactive" type="xboolean" value="false"/>

<config key="ports">

<config key="port_1">

<entry key="index" type="xint" value="1"/>

<entry key="port_spec_class" type="xstring" value="org.knime.core.data.DataTableSpec"/>

<entry key="port_object_class" type="xstring" value="org.knime.core.node.BufferedDataTable"/>

<entry key="port_object_summary" type="xstring" value="Rows: 150, Cols: 6"/>

<entry key="port_dir_location" type="xstring" value="port_1"/>

</config>

</config>

</config>

各位大侠帮帮小弟,小弟成分感谢! --------------------编程问答-------------------- 看看dom4j怎么使用吧,还是很简单和方便的... --------------------编程问答-------------------- 试试用dom4j吧,这个东西还是很简单方便的处理XML里面的数据的... --------------------编程问答-------------------- 用jdom很方便
另外,要告诉你一点是:XPath,要会用,要知道它是做什么的
--------------------编程问答-------------------- 用dom4j吧,就是几个方法的调用,很无脑,要学习的话还是推荐自己写 --------------------编程问答-------------------- 楼上的都说了 就这两大开源库 都好使 xpath需要添加一个包非常方便 --------------------编程问答-------------------- 也可以试试用正则解析
--------------------编程问答-------------------- --------------------编程问答-------------------- 谢谢各位,我自己看了dom4j问题基本解决,可是出现了新的问题,新问题如http://topic.csdn.net/u/20120904/21/369c1cdd-6c8a-4b6c-9715-9a8e86991696.html还请各位帮忙。
补充:Java ,  Java SE
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,