On Wednesday, January 24, 2018 at 2:31:22 PM UTC+5:30, Peter Otten wrote: > 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 > > ?
I guess Dieter has cleared [thanks Dieter] that namespaces dont inherit to child tags. I need to wrap my head around the concepts and the syntax -- https://mail.python.org/mailman/listinfo/python-list