This patch tries to fix the problem with wrong
names reported in the endElement handler, when
namespace processing is on.
The reason for the problem is that Expat passes
the buffer for the namespace URI to the handler,
copying the element's local name (and prefix) to
the end of the buffer, right after the URI.
This saves re-copying the URI.
However, if multiple nested elements use the same
namespace URI, the names of the top elements
get overwritten, since only one buffer is used,
and therefore the endElement handler will only
report the name of the last, most deeply nested
I have tried to fix this by re-copying localPart
and prefix before the endelement handler is called.
Another approach could have been to use separate
buffers (e.g. tag->buf), but this would have meant
copying the whole URI for each element in the
namespace, so I think the solution I tried is
at least as efficient.
This type of solution was already tried once by
the user "maki", but only for NSTriplets reporting,
not for NS processing in general.
The patch applies to xmlparse.c rev. 1.44.
Please test thoroughly - this patch needs
to be done right.
Log in to post a comment.