我有这样的XML结构,Minidom:我如何检查我是否有预期的根和儿童?
<root>
<child1>
</child1>
<child2>
</child2>
<child3 />
<extendedchild:name>
</extendedchild:name>
</root>
如何检查与minidom命名,这根是root
,而孩子总是跟随着要素是什么?
child1
child2
child3
extendedchild
我想也可以打印出来有根或没有在上面的 “儿童名单” 中的元素(outofroot,notachild): ...
<notachild />
</root>
<outofroot />
编辑 : 看来,outofroot
元素被minidom
解析器处理,它给出xxxxxxx.xml has an error: junk after document element: line 12, column 0
似乎'outofroot'元素被分析器处理,它提供了'xxxxxxx.xml有一个错误:文档元素后的垃圾:行12,列0' –