Rustom Mody wrote:

> With
> # Read above xml
>>>> with open('soap_response.xml') as f: inp = etree.parse(f)
> # namespace dict
>>>> nsd = {'soap': "http://schemas.xmlsoap.org/soap/envelope/";, 'locns':
>>>> "http://example.com/"}
> 
> The following behavior is observed — actual responses elided in the
> interest of brevity
> 
>>>> inp.xpath('//soap:Body', namespaces = nsd)
> finds/reaches the node
> 
>>>> inp.xpath('//locns:blobRetrieveResponse', namespaces = nsd)
> finds
> 
>>>> inp.xpath('//locns:dtCreationDate', namespaces = nsd)
> does not find
> 
>>>> inp.xpath('//dtCreationDate', namespaces = nsd)
> finds
> 
>>>> inp.xpath('//dtCreationDate')
> also finds
> 
> 
> Doesnt this contradict the fact that dtCreationDate is under the locns
> namespace??
> 
> Any explanations??

Can you rewrite that question as a simple self-contained demo, similar to 
the snippet shown under

http://lxml.de/xpathxslt.html#namespaces-and-prefixes

?

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to