1

I am using ElementTree of python to analysis xml, just like below:

<suite  id="s1" name="SW upgrade">
    <suite  id="s1-s1" name="BASIC FUNCTION">
         <test name="my test">
              <status status="fail"/>
         </test>
    </suite>
</suite>

I have found test element by below code

import xml.etree.ElementTree as ET
xml = [above xml content]
xmlroot = ET.fromstring(xml)
testElement = xmlroot.find(".//test")

my question: can i get parent element of testElement just like testElement.parent()?

john zhao
  • 986
  • 1
  • 6
  • 8

0 Answers0