I have some XML in a unicode-string variable in Python as follows:
<?xml version='1.0' encoding='UTF-8'?>
<results preview='0'>
<meta>
<fieldOrder>
<field>count</field>
</fieldOrder>
</meta>
<result offset='0'>
<field k='count'>
<value><text>6</text></value>
</field>
</result>
</results>
How do I extract the 6
in <value><text>6</text></value>
using Python?
With lxml:
Edit: But I imagine there could be more than one result...
BeautifulSoup is the most simple way to parse XML as far as I know...
And assume that you have read the introduction, then just simply use: