Below is the XML file I am trying to read.
<annotation>
<folder>JPEGImages</folder>
<filename>L00030.png</filename>
<path>D:\Annotation\Station1\S12508\JPEGImages\L00030.png</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>1280</width>
<height>720</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>bezel</name>
<pose>Unspecified</pose>
</object>
<object>
<name>plate</name>
<pose>Unspecified</pose>
</object>
</annotation>
In the above XML, I am trying to read the value of object with name, so in this case, it will be bezel and plate. I am trying to do this using xml Python package
xmlTree = ET.parse("file.xml")
elemList = []
for elem in xmlTree.iter():
elemList.append(elem.tag)
This way I am able to get all the elements but unable to get the value. What is the best way to achieve this?
elem.texttext. See stackoverflow.com/q/19583501/407651xmlPython package" is ambiguous. There are several XML-related modules in the standard library: docs.python.org/3/library/xml.html.