GNOME Bugzilla – Bug 105992
Incorrect validation error with #FIXED and namespaces
Last modified: 2009-08-15 18:40:50 UTC
When using #FIXED attributes in the DTD to simulate namespaces, xmllint gives a validity error where it shouldn't. For example, if the following is declared for in the DTD: <!ATTLIST a:inner xmlns:a CDATA #FIXED 'urn:namespace'> the namespace declaration should be allowed, but optional. If, in the document, the namespace declaration is present, it validates. But if it is absent you get: validity error: No declaration for attribute xmlns:a of element inner This error message indicates that libxml2 is treating the attribute as if it were there, but not declared in the DTD. Very strange. I'm not sure precisely when this error crept in. I've seen it since 2.5.1, but it was not in 2.4.23 I'll attach a full testcase.
Created attachment 14295 [details] Simple testcase
Okay I found the bug, using the wrong string in one specific path: diff -r1.107 SAX.c 937c937 < ctxt->node, prefix, nsret, value); --- > ctxt->node, name, nsret, value); paphio:~/XML -> cat tst3.xml <?xml version="1.0"?> <!DOCTYPE a:outer [ <!ELEMENT a:outer (a:inner)> <!ATTLIST a:outer xmlns:a CDATA #FIXED 'urn:namespace'> <!ELEMENT a:inner EMPTY> <!ATTLIST a:inner xmlns:a CDATA #FIXED 'urn:namespace'> <!ATTLIST a:inner attr CDATA #FIXED 'yes'> ]> <a:outer xmlns:a="urn:namespace"> <a:inner /> </a:outer> paphio:~/XML -> xmllint --valid --noout tst3.xml paphio:~/XML -> so it's fixed in CVs now, thanks for the report and testcase, Daniel
This should be closed in libxml2 release 2.5.4, thanks, Daniel
Confirmed. 2.5.4 solves the problem. Thanks!
I've found another case of this bug that this fix does not handle. I'll attach a test case. As I described in the email: http://mail.gnome.org/archives/xml/2003-March/msg00162.html, I think the fix applied for this is incorrect/ I've attached a patch that I believe is correct and handles both cases.
Created attachment 15540 [details] Second testcase
Created attachment 15541 [details] [review] Proposed patch
Okay, good catch :-) I have applied the patch and integrated both test case in the regression tests of libxml2. thanks a lot ! Daniel
The release of libxml2-2.5.7 should close this bug, thanks, Daniel