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 301600 - xmllint reports failure to load (external) dtds when --nonet specified
xmllint reports failure to load (external) dtds when --nonet specified
Status: RESOLVED INVALID
Product: libxslt
Classification: Platform
Component: general
1.1.14
Other All
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2005-04-22 15:53 UTC by Michael S.
Modified: 2015-07-06 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael S. 2005-04-22 15:53:28 UTC
jumbo:~/web/dc$ cat test.xml
<!DOCTYPE html PUBLIC "foo" "http://www.foo.example/">
<root/>

jumbo:~/web/dc$ cat minimal.dtd
<!ELEMENT root EMPTY>

jumbo:~/web/dc$ xmllint --nonet --dtdvalid minimal.dtd test.xml
I/O error : Attempt to load network entity http://www.foo.example/
test.xml:1: warning: failed to load external entity "http://www.foo.example/"
<!DOCTYPE html PUBLIC "foo" "http://www.foo.example/">
                                                      ^
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "foo" "http://www.foo.example/">
<root/>

(What I actually want to do is validate XHTML files using a local copy of the
DTDs and entities; I'd assumed that --nonet (to not fetch DTDs) and --dtdvalid
(to validate against a local DTD) would accomplish this.)
Comment 1 Fiable.biz 2015-01-19 07:47:35 UTC
I suggest to close this 10-year old bug.
Comment 2 Michael S. 2015-01-19 14:23:52 UTC
Well, for what it's worth, the behavior is exactly the same as 10 years ago. Doesn't look like this is a problem for many people though…
Comment 3 Richard Ipsum 2015-07-06 10:31:10 UTC
Hi, I've just come across this problem and was about to file a bug when I found this report. xsltproc is used by asciidoc when it builds its man pages, and I am building asciidoc in a chroot with no network access, so right now my only option to build asciidoc in this environment would seem to be to disable man page generation, which is a shame.

I'm just mentioning this here to provide a real-life case where a functioning --nonet would be of use, thanks. :)
Comment 4 Daniel Veillard 2015-07-06 12:36:49 UTC
But we use it all the time, for example libvirt does that, we validate all
the generated XHTML1 pages with --nonet and the XHTML1 DTD is registered in the
catalog, works like a charm. 

 The example of #1 is broken because there is nowhere where the association
between

 <!DOCTYPE html PUBLIC "foo" "http://www.foo.example/">

and his local minimal.dtd is ever made. The document does not reference
minimal.dtd, broken test.

So yes in comment to #2 there is no where in the document to associate
the DTD given with the document in example, that can't work ... unless you
have a local catalog.

W.r.t. #3 you seems to not have your catalog properly setup. Install the
xhtml1-dtds in the RHEL/Fedora/CentOs familly of systems, or equivalent where
you use libxml2. This populates /etc/xml/catalog used for DTD lookups
without net access:

thinkpad:~/XML -> grep xhtml /etc/xml/catalog
  <nextCatalog catalog="xhtml1-dtds-1.0-20020801.11.xml"/>
thinkpad:~/XML -> cat /etc/xml/xhtml1-dtds-1.0-20020801.11.xml
<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <delegatePublic publicIdStartString="-//W3C//DTD XHTML 1.0" catalog="file:///usr/share/xml/xhtml/1.0/catalog.xml"/>
  <delegatePublic publicIdStartString="-//W3C//ENTITIES Latin 1 for XHTML" catalog="file:///usr/share/xml/xhtml/1.0/catalog.xml"/>
  <delegatePublic publicIdStartString="-//W3C//ENTITIES Special for XHTML" catalog="file:///usr/share/xml/xhtml/1.0/catalog.xml"/>
  <delegatePublic publicIdStartString="-//W3C//ENTITIES Symbols for XHTML" catalog="file:///usr/share/xml/xhtml/1.0/catalog.xml"/>
  <delegateSystem systemIdStartString="http://www.w3.org/TR/xhtml1/DTD/" catalog="file:///usr/share/xml/xhtml/1.0/catalog.xml"/>
  <delegateURI uriStartString="http://www.w3.org/TR/xhtml1/DTD/" catalog="file:///usr/share/xml/xhtml/1.0/catalog.xml"/>
  <delegateSystem systemIdStartString="http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/" catalog="file:///usr/share/xml/xhtml/1.0/catalog.xml"/>
  <delegateURI uriStartString="http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/" catalog="file:///usr/share/xml/xhtml/1.0/catalog.xml"/>
</catalog>
thinkpad:~/XML -> 

  Then any attempt to reference part of the XHTML1 DTD from that host
using libxml2 will instead use the local files from the catalog and
this will work with --nonet.

  So #3 fix your installation it does work !

    http://xmlsoft.org/catalog.html
   

  Closing that bug as Invalid

Daniel