[XML-SIG] SAX2 features

Martin v. Loewis martin@v.loewis.de
Wed, 14 Nov 2001 00:46:42 +0100


> When feature_namespace_prefixes is set to false, should I suppress any 
> start/endPrefixMapping events?

No, you shouldn't. If the feature is set, you should include the
namespace prefixes in the *attributes* passed to startElement; if the
feature is off, you should remove them. The Python documentation for
this says

feature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes"
# true: Report the original prefixed names and attributes used for Namespace
#       declarations.
# false: Do not report attributes used for Namespace declarations, and
#        optionally do not report original prefixed names (default).
# access: (parsing) read-only; (not parsing) read/write

This talks aboute the Attributes collection, although it probably can
be misread to talk about the calling start/endPrefixMapping. The
documentation in

http://www.saxproject.org/apidoc/org/xml/sax/Attributes.html

seems somewhat clearer:

# It will also not contain attributes used as Namespace declarations
# (xmlns*) unless the http://xml.org/sax/features/namespace-prefixes
# feature is set to true (it is false by default).

HTH,
Martin