[XML-SIG] (patch) Re: Getting namespace aware parser to work...
Clark C. Evans
cce@clarkevans.com
Mon, 19 Mar 2001 06:38:47 -0500 (EST)
It's not perfect (since it doesn't use a stack for implicit
namespaces), but the errors I was getting should be fixed
by this patch. Clark
........................
_xmlplus/sax/saxutils.py
.........................
171c171,172
< name = name[1]
---
> qname = name[1]
> self._out.write('<' + qname)
173,175c174,181
< name = self._current_context[name[0]] + ":" + name[1]
< self._out.write('<' + name)
<
---
> prefix = self._current_context[name[0]]
> if prefix is None:
> self._out.write('<%s xmlns="%s"' % (name[1],name[0]) )
> qname = name[1]
> else:
> qname = prefix + ":" + name[1]
> self._out.write('<' + qname)
>
177c183,186
< self._out.write(' xmlns:%s="%s"' % pair)
---
> if pair[0] is None:
> pass
> else:
> self._out.write(' xmlns:%s="%s"' % pair)
181,182c190,194
< name = self._current_context[name[0]] + ":" + name[1]
< self._out.write(' %s="%s"' % (name, escape(value)))
---
> if name[0] is None:
> qname = name[1]
> else:
> qname = self._current_context[name[0]] + ":" + name[1]
> self._out.write(' %s="%s"' % (qname, escape(value)))
192c204,208
< qname = self._current_context[name[0]] + ":" + name[1]
---
> prefix = self._current_context[name[0]]
> if prefix is None:
> qname = name[1]
> else:
> qname = prefix + ":" + name[1]