ElementTree Namespace Prefixes

uche.ogbuji at gmail.com uche.ogbuji at gmail.com
Sat Jun 18 02:48:38 EDT 2005


Chris Spencer:
"""
Fredrik Lundh wrote:
> Chris Spencer wrote:

> > If an XML parser reads in and then writes out a document without having
> > altered it, then the new document should be the same as the original.

> says who?

Good question. There is no One True Answer even within the XML
standards.

It all boils down to how you define "the same". Which parts of the XML
document are meaningful content that needs to be preserved and which
ones are mere encoding variations that may be omitted from the internal
representation?
"""

One can point out the XML namespaces spec all one wants, but it doesn't
matter.  The fact is that regardless of what that spec says, as you
say, Chris, there are too many XML technologies that require prefix
retention.    As a simple example, XPath and XSLT, W3C specs just like
XMLNS, uses qnames in context, which requires prefix retention.
Besides all that, prefix retention is generally more user friendly in
round-trip or poartial round-trip scenarios.

That's why cDomlette, part of 4Suite [1] and Amara [2], a more Pythonic
API for this, both support prefix retention by default.

[1] http://4suite.org
[2] http://uche.ogbuji.net/tech/4Suite/amara/

-- 
Uche
http://copia.ogbuji.net




More information about the Python-list mailing list