1

I have the following xml :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:result xmlns:ns2="http://ws.def.com/">
<ns3:value>QWESW12323D2412123S</ns3:value>
</ns3:result>

and want to parse it with python and extract this text i tried the following :

from xml.etree import ElementTree as etree
xml = etree.fromstring(data)

item = xml.find('ns3:value')
print item

but i get empty item ,could someone help to achieve this with Python?

smith
  • 3,232
  • 26
  • 55
  • 1
    Possible duplicate of [Parsing XML with namespace in Python via 'ElementTree'](http://stackoverflow.com/questions/14853243/parsing-xml-with-namespace-in-python-via-elementtree) – styvane Jan 10 '16 at 23:04

1 Answers1

0

Use the syntax '{ns3}value' to apply the namespace - although as ns3 isn't defined, I don't think this is actually valid xml.