Peter Otten, 13.04.2014 10:56:
> from xml.etree import ElementTree as ET
> #root = ET.parse(filename).getroot()
> root = ET.fromstring(data)
> for department in root.findall(".//department"):
> name = department.find("name").text
> desc = department.find("desc").text
name = departmen
bruce wrote:
> The following text contains sample data. I'm simply trying to parse it
> using libxml2dom as the lib to extract data.
>
> As an example, to get the name/desc
>
> test data
>
>
> d = libxml2dom.parseString(s, html=1)
>
> p1="//department/name"
> p2="//department/desc
Hi.
The following text contains sample data. I'm simply trying to parse it
using libxml2dom as the lib to extract data.
As an example, to get the name/desc
test data
d = libxml2dom.parseString(s, html=1)
p1="//department/name"
p2="//department/desc"
pcount_ = d.xpath(p1)