Oct-31-2022, 12:40 PM
(This post was last modified: Oct-31-2022, 12:40 PM by saisankalpj.)
I have a spml file as below:
My code is right now:
The above spml is just a sample spml file what i have.Any errors in the sample spml ,please overlook them
<?xml version="1.0" encoding="UTF-8"?> <spml:batchresponse designation="software developers"> <response> <position alias="role">Python developer</position> </response> <response> <position alias="role">java developer</position> </response> </spml:batchresponse>So ,My requirement is I should be able to check initially if designation=software developer.If it is software developer only i should extract the data between the <response></response> tag .I also want to access the data within <position alias="role"></position> tag
My code is right now:
import xml.etree.ElementTree as ET tree = ET.parse('abc.spml') root = tree.getroot() for i in tree.findall('response'): print (ET.tostring(i))But i am unable to access the data within the position alias="role" and i am unable to check if designation="software developers"
The above spml is just a sample spml file what i have.Any errors in the sample spml ,please overlook them