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 445790 - xmllint problem agains a given dtd (--dtdvalid) (bis)
xmllint problem agains a given dtd (--dtdvalid) (bis)
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: general
2.6.28
Other Linux
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2007-06-09 15:36 UTC by massimo morara
Modified: 2021-07-05 13:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description massimo morara 2007-06-09 15:36:01 UTC
Here are a couple of 'xml' and a 'dtd' files

--- begin "a.xml" ---
<?xml version="1.0"?>
<!DOCTYPE root SYSTEM "a.dtd">
<root ns:attr="1"/>
--- end "a.xml" ---

--- begin "b.xml" ---
<?xml version="1.0"?>
<root ns:attr="1"/>
--- end "b.xml" ---

--- begin "a.dtd" ---
<!ELEMENT root EMPTY>
<!ATTLIST root
          xmlns:ns CDATA #FIXED "http://foo-dtd.org"
          ns:attr CDATA #IMPLIED>
--- end "a.dtd" ---

When i use 'xmllint' to verify the validity of "a.xml" against "a.dtd" implicitly ("--valid") or explicitly ("--dtdvalid a.dtd"), all goes well: "a.xml" result valid.

But when i verify the validity of "b.xml" explicitly against "a.dtd" ("--dtdvalid a.dtd"), i obtain the following error:

--- begin output ---
<root ns:attr="1"/>
                 ^
b.xml:2: element root: validity error : No declaration for attribute attr of element root
Document b.xml does not validate against a.dtd
--- end output ---

I suppose that this bug (i suppose this is a bug) is caused by the fact that the attributes default values are write down in the parser context ("xmlHashTablePtr    attsDefault"); i suppose they must be write down in the internal or in the external subset.
When xmlParseDTD() (xmlSAXParseDTD()) return the dtd pointer, the 'attsDefault' are missed.

When 'xmllint' validate "a.xml" explicitly ("--dtdvalid") against "a.dtd", it use the dtd explicitly loaded *and* the 'attsDefault' implicitly loaded; so "a.xml" result valid.
When 'xmllint' validate "b.xml" explicitly against "a.dtd", the 'attsDefault' are missed; so "b.xml" result invalid.

If i'm not wrong, obvioulsy

massimo morara
Comment 1 Fiable.biz 2015-01-19 07:48:58 UTC
I suggest to close this 8 years old bug.
Comment 2 Nick Wellnhofer 2017-06-13 23:56:55 UTC
With 2.9.4 the document validates, but I get a namespace error:

b.xml:2: namespace error : Namespace prefix ns for attr on root is not defined
<root ns:attr="1"/>
                 ^
<?xml version="1.0"?>
<root ns:attr="1"/>

So it seems that there's a problem with default attributes from DTDs loaded via --dtdload. But this looks more like an enhancement than a bug.
Comment 3 GNOME Infrastructure Team 2021-07-05 13:26:51 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxml2/-/issues/

Thank you for your understanding and your help.