Re: [xml] Improper Type Returned For Repeated Attribute Declaration



On Thu, Jan 10, 2008 at 02:53:20PM +0530, Ashwin wrote:
   >  I will look at this probably tomorrow morning,

   How about adding this check in function xmlHashAddEntry3:-


   If (insert != NULL)

   entry->payload = userdata;


   This  check  will  ensure  that  in case of duplicate entries the type
   remains the original one instead the latest one.

  That doesn't work, on the given example there is only one 
special attribute defined and that's the second one, you won't
even get a duplicate in ctxt->attsSpecial . Also I really don't
want to change the semantic of public API, that's impossible.
I have made a proper patch for this. There is no way around 
callecting all attribute type definitions at the parser ctxt 
level, I did this in the DTD parsing phase using ctxt->attsSpecial,
then xmlAddSpecialAttr is modified to always keep only the first
entry, then when the DTD parsing for the document is done, 
all CDATA attributes are removed from ctxt->attsSpecial.
This last step is done at 3 places in the code 1 for the normal
parsing and 2 for the push parser which operates differently.
This also required to fix the Hash table scanner to not crash
in some case of hashed element removal in the scanner callback.
  Patch enclosed has been tested on various tests, and looks fine to
me so I commited it in revision 3669.

   thanks for the report,

Daniel
-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

Attachment: att_dup.patch
Description: Text document



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]