XML : Parsing XML with Identical Keys and Attribute Names

I'm working with an API that outputs all its XML with the same key and uses the same attribute name:

  <response uri="/webaddress/">    <result>      <Quotes>        <row no="1">          <FL val="ID">12345</FL>          <FL val="Number">            <![CDATA[ 12346 ]]>          </FL>          <FL val="Subject">            <![CDATA[ Test ]]>          </FL>          <FL val="Stage">            <![CDATA[ Draft ]]>          </FL>          <FL val="Valid Till">            <![CDATA[ 2016-01-23 ]]>          </FL>          <FL val="CONTACTID">12121</FL>    

I'm sure I can still work with it, but I'm pretty new and I'm struggling to find any examples that apply. I'm working in Python 3.5 with xml.etree but I don't really care what library I'm working with.

Could someone offer a example of how to get the content out of an element given a particular name-value attribute pair, i.e. store the '12345' or '12346' as a variable?

No comments:

Post a Comment