Quantcast
Channel: Find occurrence using multiple attributes in ElementTree/Python - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Find occurrence using multiple attributes in ElementTree/Python

$
0
0

I have the following XML.

<?xml version="1.0" encoding="UTF-8"?><testsuites tests="10" failures="0" disabled="0" errors="0" time="0.001" name="AllTests"><testsuite name="TestOne" tests="5" failures="0" disabled="0" errors="0" time="0.001"><testcase name="DefaultConstructor" status="run" time="0" classname="TestOne" /><testcase name="DefaultDestructor" status="run" time="0" classname="TestOne" /><testcase name="VHDL_EMIT_Passthrough" status="run" time="0" classname="TestOne" /><testcase name="VHDL_BUILD_Passthrough" status="run" time="0" classname="TestOne" /><testcase name="VHDL_SIMULATE_Passthrough" status="run" time="0.001" classname="TestOne" /></testsuite></testsuites>

Q : How can I find the node <testcase name="VHDL_BUILD_Passthrough" status="run" time="0" classname="TestOne" />? I find the function tree.find(), but the parameter to this function seems element name.

I need to find the node based on attribute : name = "VHDL_BUILD_Passthrough" AND classname="TestOne".


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>