I have the following XML which I have parsed from a webpage:
<!--
Parts from the iGEM Registry of Standard Biological Parts
-->
<rsbpml>
<part_list>
<part>
<part_id>151</part_id>
<part_name>BBa_B0034</part_name>
<part_short_name>B0034</part_short_name>
<part_short_desc>RBS (Elowitz 1999) -- defines RBS efficiency</part_short_desc>
<part_type>RBS</part_type>
<release_status>Released HQ 2013</release_status>
<sample_status>In stock</sample_status>
And I want to extract some of the values.
For example I want to ouput the value RBS from <part_type>.
I've tried the following:
bb_xml_raw = urllib2.urlopen("http://parts.igem.org/cgi/xml/part.cgi?part=BBa_B0034")
self.parse = ET.parse(bb_xml_raw)
self.root = self.parse.getroot()
for part in self.root.findall('part_list'):
print part.find('part_type').text
But it doesn't work, I get: AttributeError: 'NoneType' object has no attribute 'text'
What am I doing wrong?