Reading XML namespaces

Adam Tauno Williams awilliam at whitemice.org
Sat May 15 16:40:59 EDT 2010


On Sat, 2010-05-15 at 22:29 +0200, Stefan Behnel wrote:
> Adam Tauno Williams, 15.05.2010 20:37:
> > Say I have an XML document that begins with:
> > <?xml version="1.0" encoding="utf-8"?>
> > <dsml:dsml xmlns:dsml="http://www.dsml.org/DSML">
> > How can one access the namespaces define in this node?  I've done a fair
> > amount of XML in Python, but haven't been able to uncover the call to
> > enumerate the namespaces.
> > Primarily I am using etree from lxml.
> What do you need the namespaces for?

One needs to know the defined namespace in order to perform xpath
operations.




More information about the Python-list mailing list