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.
  In the attached file I am giving a repeated attr declaration for a1, so
the first a1 should be chosen and second one ignored, however in this case
the second attr is being considered and in the start element ns callback I
am getting a default attribute, which in this case I should not get, since
a1 should be treated as #IMPLIED, instead it is being treated as #FIXED. So
I think the problem of the repeated attr declaration in which the second
attr value is being considered still exists.....


Attachment: ReapeatedAttr1.xml
Description: Text Data

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