[Python-Dev] Elementtree and Namespaces in 2.5 (original) (raw)

Fredrik Lundh fredrik at pythonware.com
Mon Aug 14 13:58:40 CEST 2006


Martin v. Löwis wrote:

That is not enough reason. Yes, it makes certain applications impossible, e.g. when namespace prefixes are inside attribute values. It just means you can't use it for that application, then. XML has many other applications, and so does ElementTree.

there are ways to deal with this in ET, though; the "iterparse" interface gives you access to namespace prefixes, the semi-official _namespace_map dictionary gives you better control over how the default serializer maps URI:s to prefixes, and the "QName" wrapper allows you to use qualified names for individual attribute values.

dealing with namespace abusers such as SOAP and similar XML dialects are per- fectly possible, and usually not very hard.

(ET 1.3 will probably improve things further, but that won't be out before 2.5 final.)



More information about the Python-Dev mailing list