extracting result text from xml using Python
Question: 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?


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

