[lxml-dev] Parsing namespace declarations

Aaron Rubinstein arubinst at library.umass.edu
Thu Jul 23 17:42:17 CEST 2009


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?

Thanks for your help!




More information about the lxml-dev mailing list