[XML-SIG] Re: Help on processing qualified attribute values
Fredrik Lundh
fredrik at pythonware.com
Sat Mar 12 10:18:01 CET 2005
Markus Döring wrote:
> At some point I need to parse xml attributes which contain namespace prefixes as their value.
> The SAX parser does a good job on dealing with qualified names as xml tags, but is there a way I
> can access the internal sax mapping between prefixes and full namespaces
you should be able to use the
startPrefixMapping(prefix, uri)
and
endPrefixMapping(prefix)
methods in the content handler to maintain your own prefix2namespace mapping.
also see:
http://www.python.org/doc/current/lib/content-handler-objects.html
(don't forget that prefixes are nested; the same prefix can map to different URI:s at
different locations in the same document, so you cannot use a single dictionary for
the mapping. also note that SAX doesn't guarantee that startPrefix and endPrefix
events are properly nested...)
</F>
More information about the XML-SIG
mailing list