我正试图解决以下问题:
我想得到标记的'type'属性(cpe-23标记是可选的,在xmlschema中是任何类型的)
<cpe-23:deprecated-by ... type="NAME_CORRECTION"/>
在stackoverflow中阅读其他问题后,我得到了以下代码:
^{pr2}$我现在的问题是,我只得到一个空的输出,我的程序以代码:0在
有什么办法解决这个问题吗?在
先谢谢你!在
源(XML文件):
<cpe-list ...>
<generator>
...
</generator>
<cpe-item name="cpe:/a:3com:tippingpoint_ips_tos:2.2.3" deprecated="true" deprecation_date="2010-12-28T17:36:02.240Z">
<title xml:lang="en-US">3Com TippingPoint IPS TOS 2.2.3</title>
<cpe-23:cpe23-item name="cpe:2.3:a:3com:tippingpoint_ips_tos:2.2.3:*:*:*:*:*:*:*">
<cpe-23:deprecation date="2010-12-28T12:36:02.240-05:00">
<cpe-23:deprecated-by name="cpe:2.3:o:3com:tippingpoint_ips_tos:2.2.3:*:*:*:*:*:*:*" type="NAME_CORRECTION"/>
</cpe-23:deprecation>
</cpe-23:cpe23-item>
</cpe-item>
<cpe-item ...>
...
</cpe-item>
...
</cpe-list>
我读了图书馆的博士,自己能解决这个问题。没有输出的原因是元素.findall()函数只查看direkt子级。“cpe-23:cp23 item”是根节点的孙子。在
相关问题 更多 >
编程相关推荐