FreeOZ论坛
标题:
有IT大神帮忙下吗, 有偿的
[打印本页]
作者:
ohxsy
时间:
30-1-2015 16:27
标题:
有IT大神帮忙下吗, 有偿的
本帖最后由 ohxsy 于 30-1-2015 16:41 编辑
用JAVA语言 用一定的方法解析多个xml文件(他们的格式是一样的),抽取出一些指定标签里的内容,并对不同的内容按三种格式中的一种进行显色输出,同时把一些属性抽取出来放在各自的list里,以下是xml文件里的一部分
<?xml version="1.0"?>
<!DOCTYPE source_file SYSTEM "apf.v5.1.1.dtd">
<source_file URI="CNR20001109.1700.1220.sgm" SOURCE="broadcast news" TYPE="text" AUTHOR="LDC" ENCODING="UTF-8">
<document DOCID="CNR20001109.1700.1220">
<entity ID="CNR20001109.1700.1220-E1" TYPE="VEH" SUBTYPE="Land" CLASS="SPC">
<entity_mention ID="CNR20001109.1700.1220-E1-1" TYPE="NOM" LDCTYPE="NOM">
<extent>
<charseq START="64" END="69">中国福建汽车</charseq>
</extent>
<head>
<charseq START="68" END="69">汽车</charseq>
</head>
</entity_mention>
</entity>
In this example it need extaract out 汽车 to out put in color.
作者:
艾瑞克
时间:
30-1-2015 16:44
去
www.freelancer.com.au
作者:
superopengl
时间:
30-1-2015 17:34
I think it's simple if by Xpath.
作者:
Mr.Q
时间:
30-1-2015 18:02
用正则两行代码搞定。。
作者:
zymzxq
时间:
30-1-2015 18:13
我的第一反应是遍历dom,
作者:
superopengl
时间:
30-1-2015 18:17
Mr.Q 发表于 30-1-2015 16:02
用正则两行代码搞定。。
Yes, but since it's XML, using XML way should be more readable.
作者:
nkcoder
时间:
6-2-2016 00:04
用XPath或beautifulsoup应该不难搞定
欢迎光临 FreeOZ论坛 (https://hioz.im/ibbs/)
Powered by Discuz! X3.2