如何使用xml解析在xml中选择属性 [英] How to select a attribute in xml by using xml parsing

查看:82
本文介绍了如何使用xml解析在xml中选择属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <   vs:period     sysid   =  2     periodtype   =  DAILY    name   =  DAILY    periodseqnum   =  886    periodbegindate   =  2014-05-25T23:05 :57-05:00    periodenddate   =  2014-05-26T23:05:04-05:00    xmlns:vs   =  #unknown    /  >  




上面标签中的
包含sysid,periodtype,name,periodseqnum,periodbegindate等如何通过使用html解析来获取这些字段值

解决方案

参考:读写xml文件 [ ^ ]


检查此链接。注意:您需要使用命名空间来表示vs(vs:period)。



http://stackoverflow.com/questions/13194183/how-to-get-attribute-value-from-node-using-xpath [ ^

<vs:period sysid="2" periodtype="DAILY" name="DAILY" periodseqnum="886" periodbegindate="2014-05-25T23:05:57-05:00" periodenddate="2014-05-26T23:05:04-05:00" xmlns:vs="#unknown" />



in above tag contain sysid, periodtype,name,periodseqnum, periodbegindate etc how to get those fields values by using html parsing

解决方案

Refer: reading-and-writing-xml-files[^]


Check this link. NOTE: Your need to use namespace for vs (vs:period ).

http://stackoverflow.com/questions/13194183/how-to-get-attribute-value-from-node-using-xpath[^]


这篇关于如何使用xml解析在xml中选择属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆