On 3/31/2013 9:29 AM, Stefan Behnel wrote:
Your assumption about the default namespace is incorrect here.
http://www.w3.org/TR/REC-xml-names/#defaulting
Basically, attributes in the default namespace are badly defined. Don't use them. Instead, use an explicit namespace prefix for them, either by defining the namespace URI twice or by not using the default namespace at all.
I came up with a better example. It looks like I'm not understanding something, because this script should now return the attribute with its correct namespace because I've added a prefix for opf to metadata. I think I should get this output:
<package xmlns="http://www.idpf.org/2007/opf">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
Stefan
_________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml