[ expat-Patches-567035 ] Patch for bug # 566334

noreply@sourceforge.net noreply@sourceforge.net
Wed Jun 12 13:19:02 2002


Patches item #567035, was opened at 2002-06-10 15:53
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=567035&group_id=10127

Category: None
Group: None
Status: Open
Resolution: None
Priority: 8
Submitted By: Karl Waclawek (kwaclaw)
Assigned to: Karl Waclawek (kwaclaw)
Summary: Patch for bug # 566334

Initial Comment:
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
element .

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.

Karl

----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-06-12 16:18

Message:
Logged In: YES 
user_id=3066

Your description of the problem and proposed solution sounds
good, and a quick test of your patch using xmlwf works. 
I'll see if I can knock out a quick test case for this for
the regression suite.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=567035&group_id=10127