[lxml-dev] Parsing namespace declarations

Christian Zagrodnick cz at gocept.com
Fri Jul 31 07:59:34 CEST 2009


On 2009-07-23 17:42:17 +0200, Aaron Rubinstein 
<arubinst at library.umass.edu> said:

> Hello,
> 
> I'm trying to test for the presence of a specific namespace declaration
> in my document root but the namespace declarations don't seem to appear
> in the root.attrib dictionary.
> 
> Here is an example of my doc root:
> 
> <mods:mods version="3.3" xmlns:mods="http://www.loc.gov/mods/v3"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.loc.gov/mods/v3
> http://www.loc.gov/standards/mods/v3/mods-3-3.xsd"
> xmlns:xlink="http://www.w3.org/1999/xlink">
> 
> Does lxml provide a way to parse the namespace declarations?

Aren't those in the nsmap attribute? Or was it namespaces?


-- 
Christian Zagrodnick · cz at gocept.com
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 4 · fax +49 345 1229889 1
Zope and Plone consulting and development




More information about the lxml-dev mailing list