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

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



>Hi,
>   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.....
For the above problem I am attaching a patch, but I am not sure whether it
is correct, I might have missed out some flow in which the patch might not
work or cause some problems. I am checking using the hash scan to check if
an attr is being repeated , and in case it is then I return from there
before adding the default attributes, this testcase is passing along with
some other combinations that I tried. Please let me know if this is correct.
Thanks!!
Regards
Ashwin
<!DOCTYPE doc [
<!ATTLIST doc a1 NMTOKENS " 1  	2 	">
<!ELEMENT doc (#PCDATA)>
]>
<doc></doc>
*** orgparser.c	2008-02-27 18:13:22.000000000 -0800
--- parserdefattrfix.c	2008-02-27 18:16:23.626432352 -0800
*************** xmlAddDefAttrs(xmlParserCtxtPtr ctxt,
*** 878,883 ****
--- 878,889 ----
      const xmlChar *name;
      const xmlChar *prefix;
  
+     if (ctxt->attsSpecial != NULL)
+     {
+         if (xmlHashLookup2(ctxt->attsSpecial, fullname, fullattr) != NULL)
+         return;
+     }
+ 
      if (ctxt->attsDefault == NULL) {
          ctxt->attsDefault = xmlHashCreateDict(10, ctxt->dict);
  	if (ctxt->attsDefault == NULL)


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