我目前有一个XML文件,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<max:CreateMXCLASSIFICATION xmlns:max="http://www.ibm.com/max">
<max:MXCLASSIFICATIONSet>
<max:CLASSSTRUCTURE>
<max:MAXINTERRORMSG>string</max:MAXINTERRORMSG>
<max:CLASSSTRUCTUREID>string</max:CLASSSTRUCTUREID>
<max:CLASSSPEC action="AddChange">
<max:ASSETATTRID>string</max:ASSETATTRID>
<max:ORGID>string</max:ORGID>
<max:SECTION>string</max:SECTION>
<max:SITEID>string</max:SITEID>
<max:CLASSSPECUSEWITH action="AddChange">
<max:OBJECTNAME1>string</max:OBJECTNAME1>
</max:CLASSSPECUSEWITH>
</max:CLASSSPEC>
<max:CLASSUSEWITH action="Replace">
<max:OBJECTNAME2>string</max:OBJECTNAME2>
</max:CLASSUSEWITH>
</max:CLASSSTRUCTURE>
</max:MXCLASSIFICATIONSet>
</max:CreateMXCLASSIFICATION>
我试图提取结构以创建字典,但是现在下面的代码在逻辑上有一个错误,我无法发现。当前,当rChild被重新分配子节点列表并继续迭代时,不会检查以下元素的子节点:
<max:ASSETATTRID>string</max:ASSETATTRID>
<max:ORGID>string</max:ORGID>
<max:SECTION>string</max:SECTION>
<max:SITEID>string</max:SITEID>
<max:CLASSSPECUSEWITH action="AddChange">
以下是我正在使用的代码:
rChild = root.childNodes
for x in range(7):
for y in rChild:
if y.localName is not None:
rChild = y.childNodes
print rChild
任何指导都将不胜感激
目前没有回答
相关问题 更多 >
编程相关推荐