我有这个 xml 文件,我需要获取类别、属性和测试用例,我使用 XML::LibXML 和 findnodes 成功完成了问题是有时结构不同,所以可能会有更多的测试套件和结果节点然后findnodes中的节点不正确。
那么处理它的最佳方法是什么?如果我不知道正确的基本起始节点,则不确定如何搜索 type="Fixture (这是具有我需要的信息的节点)。
<test-A>
<test-suite type="Project">
<results>
<test-suite type="Setup">
<results>
<test-suite type="Fixture>
<categories>
<category name="AAA" />
<category name="BBB" />
</categories>
<properties>
<property name="CCC" />
<property name="DDD" />
</properties>
<results>
<test-case name="EEE" />
<test-case name="DDD" />
</results>
</test-suite>
</results>
</test-suite>
</results>
</test-suite>
</test-A>