After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 105992 - Incorrect validation error with #FIXED and namespaces
Incorrect validation error with #FIXED and namespaces
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.5.2
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2003-02-13 15:02 UTC by Brent Hendricks
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Simple testcase (316 bytes, text/xml)
2003-02-13 15:03 UTC, Brent Hendricks
  Details
Second testcase (197 bytes, text/xml)
2003-04-07 17:46 UTC, Brent Hendricks
  Details
Proposed patch (639 bytes, patch)
2003-04-07 17:46 UTC, Brent Hendricks
none Details | Review

Description Brent Hendricks 2003-02-13 15:02:12 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.
Comment 1 Brent Hendricks 2003-02-13 15:03:08 UTC
Created attachment 14295 [details]
Simple testcase
Comment 2 Daniel Veillard 2003-02-24 17:46:42 UTC
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
Comment 3 Daniel Veillard 2003-02-25 11:58:12 UTC
This should be closed in libxml2 release 2.5.4,

  thanks,

Daniel
Comment 4 Brent Hendricks 2003-02-25 14:27:38 UTC
Confirmed.  2.5.4 solves the problem.

Thanks!
Comment 5 Brent Hendricks 2003-04-07 17:44:35 UTC
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.
Comment 6 Brent Hendricks 2003-04-07 17:46:25 UTC
Created attachment 15540 [details]
Second testcase
Comment 7 Brent Hendricks 2003-04-07 17:46:49 UTC
Created attachment 15541 [details] [review]
Proposed patch
Comment 8 Daniel Veillard 2003-04-22 08:38:22 UTC
Okay, good catch :-)
I have applied the patch and integrated both test case in the
regression tests of libxml2.

  thanks a lot !

Daniel
Comment 9 Daniel Veillard 2003-04-25 10:21:47 UTC
  The release of libxml2-2.5.7 should close this bug,
                                                                     
          
    thanks,
                                                                     
          
Daniel