On Fri, Apr 18, 2008 at 04:10:29PM +0800, Ashwin wrote: > ----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of > Daniel Veillard > Sent: 2008年3月26日 0:55 > To: Ashwin > Cc: [email protected]; [EMAIL PROTECTED] > Subject: Re: [xml] Normalization Query > > On Wed, Mar 19, 2008 at 10:15:15AM +0530, Ashwin wrote: > > The confusion is exarcebated by the fact that Java based parsers are doing > > Normalization which returns values which I have mentioned that are > contrary > > to what is being returned by libxml.. > > > > > > > > I do not know whether I am interpreting the spec wrongly, so any > > clarifications regarding the same would be extremely welcome. > > > > > No that was libxml2 bugs :-\ . They were a bit hard to fix, but hopefully > > they are fixed in SVN, could you please checkout and rerun your tests. > > I have tried to include your examples in the regression suite, and also > > fixed the over normalization issue you raised earlier. > > > I hope this is fine now, > > Thanks for the fixes!!! > > However there seems to be a slight problem in xmlAttrNormalizeSpace2... > > When this function is called in xmlParseAttribute2.. > > val2 = xmlAttrNormalizeSpace2(ctxt, val, len); > if (val2 != NULL) { > xmlFree(val); // Here if only leading spaces are present > > val = val2; //xmlAttrNormalizeSpace2 returns the pointer to the first > > char after the leading spaces, so in this case val2 > will point to the same memory as val except it will be > > ahead by the number of whitespaces.... > > So freeing val will in effect free val2 as well, and thus will lead to > problems. > > I am attaching a patch which takes care of the problem. Please let me know > if this is ok.
As you can see i'm checking my old mail, yes i found the problem too probably using the same test suite, but fixed it in a simpler way which didn't need a new allocation, just with a memmove, see at the bottom of xmlAttrNormalizeSpace2 in CVS, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ [EMAIL PROTECTED] | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
