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:
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:
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?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> |
My code is right now:
1 2 3 4 5 |
import xml.etree.ElementTree as ET tree = ET.parse( 'abc.spml' ) root = tree.getroot() for i in tree.findall( 'response' ): print (ET.tostring(i)) |
The above spml is just a sample spml file what i have.Any errors in the sample spml ,please overlook them