[XML-SIG] sax parsing and namespaces

Alexandre Fayolle Alexandre.Fayolle@logilab.fr
Fri, 16 Nov 2001 12:18:20 +0100 (CET)


On 16 Nov 2001, Lars Marius Garshol wrote:

> * Alexandre Fayolle
> | 
> | Well xml.sax.drivers2.drv_pyexpat and xml.sax.drivers2.drv_xmlproc
> | seem to be behaving that way, except that PyExpat has the feature
> | disabled by default (bug #482001)
> 
> It should be disabled by default. I've changed this many times, but
> someone seems to be changing it back. I guess we need to discuss this
> and agree on one solution, and then document that.

Why should it be disabled by default? Why introduce this major difference
with Java's SAX. http://www.saxproject.org/?selected=namespaces says:

"The http://xml.org/sax/features/namespaces feature controls general
Namespace processing. When this feature is true (the default), any
applicable Namespace URIs and local names must be available through the
startElement and endElement callbacks in the ContentHandler interface, and
through the various methods in the Attributes interface, and
start/endPrefixMapping events must be reported. Element and attribute
names without associated namespace URIs will be presented as having an
empty string for those values, and the qName parameter is guaranteed to be
provided as a non-empty string.

The http://xml.org/sax/features/namespace-prefixes feature controls the
reporting of qNames and Namespace declarations (xmlns* attributes): when
this feature is false (the default), qNames may optionally be reported as
empty strings for elements and attributes that have an associated
namespace URI, and xmlns* attributes must not be reported."

So the default in Java is true for namespaces, and false for
namespace-prefixes. Why should Python sax be different? Providing a more
pythonic API is fine with me, but changing the default value of an
important setting is confusing to say the least. 

Alexandre Fayolle
-- 
LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
Narval, the first software agent available as free software (GPL).