[XML-SIG] SAX Namespaces

Greg Stein gstein@lyra.org
Tue, 4 Jul 2000 02:17:02 -0700


On Tue, Jul 04, 2000 at 11:08:50AM +0200, Lars Marius Garshol wrote:
>...
> What I mean is that expat already has namespace handling, but with an
> interface that is tuned for C and not for Python.  I think that rather
> than just directly translating the C interface into Python we should
> try to make it more convenient.
> 
> At the moment expat represents namespace names as 'uri localname'.
> What I would want pyexpat.c to do is to turn those cooked strings into
> ('uri', 'localname') tuples. So it's not a matter of reimplementing
> anything, but just of improving the interface.

Simple code:

const char *space = strchr(name, ' ');
PyObject *obNS = PyString_FromStringAndSize(name, space - name);
PyObject *obName = PyString_FromString(space + 1);


Of course, I don't know how to get the original prefix/rawname...

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/