Adam Tauno Williams, 16.05.2010 06:00:
Given that XML documents can be very large I'd rather avoid a parsing of
the document [beyond what lxml/etree] has already done] just to retrieve
the namespaces and their prefixes.

In order to find out which prefixes are used in the document and which set of namespace URIs each of them is mapped to, you need to traverse the entire document and aggregate all namespace definitions on all Elements. However, the result will be mostly useless, as a prefix is only meaningful within the scope of its definition. It doesn't have any sensible meaning for the entire document.

Stefan

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to