Re: [xml] xmllint DTD troubles



Hi Michael,

Thank you for helping.

On 2012-06-06 18:27, Michael Ludwig wrote:
Lars Skjærlund schrieb am 06.06.2012 um 16:03 (+0200):

We're trying to validate XHTML documents using the following syntax:

xmllint --noout --dtdvalid /etc/xml/xhtml/xhtml1-transitional.dtd <filename>

This works - kind of: If I omit the path to the DTD, xmllint complains
that it cannot find the DTD.
The --dtdvalid switch is meant to be used with a filename argument.
If you don't need that because you're relying on the DOCTYPE of the
document, then use the --valid switch. (But maybe I got you wrong.)

I _am_ using it with a filename as the argument - because I do not want to rely on the DOCTYPE.


xmllint does not, however, load the external references in the
standard DTD: For the standard W3C, you have three external files
defining various entities such as &nbsp;.
What is the "standard DTD" and which files or URLs does xmllint fail to
load?
If by "standard W3C DTDs" you mean the ones from the W3C servers:
That won't work, they're usually blocked.

I'm sorry I didn't make myself clear enough: Yes, I mean the DTDs from the W3C servers - and yes, I know they're usually blocked - and yes, that's why I have installed the same files locally in the catalog at /etc/xml. And that's why I'm pulling in the local file using --dtdvalid.

The DTD for XHTML Transitional is usually called "xhtml1-transitional.dtd" as in the example above. About the first thing in this file, however, is commands to pull in three more files:

<!--
   Extensible HTML version 1.0 Transitional DTD

   This is the same as HTML 4 Transitional except for
   changes due to the differences between XML and SGML.

   Namespace = http://www.w3.org/1999/xhtml

   For further information, see: http://www.w3.org/TR/xhtml1

   Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
   All Rights Reserved.

   This DTD module is identified by the PUBLIC and SYSTEM identifiers:

   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";

   $Revision: 1.27 $
   $Date: 2002/08/01 18:16:48 $

-->

<!--================ Character mnemonic entities =========================-->

<!ENTITY % HTMLlat1 PUBLIC
   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
   "xhtml-lat1.ent">
%HTMLlat1;

<!ENTITY % HTMLsymbol PUBLIC
   "-//W3C//ENTITIES Symbols for XHTML//EN"
   "xhtml-symbol.ent">
%HTMLsymbol;

<!ENTITY % HTMLspecial PUBLIC
   "-//W3C//ENTITIES Special for XHTML//EN"
   "xhtml-special.ent">
%HTMLspecial;


My problem is that xmllint _does_ load the primary file, but it does not pull in the three files mentioned here - even though the files are present on disk and correctly configured in the catalog file:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>
<!--
  Comment the DTD declaration to avoid looking for it on the web.
  Alternatively we can place a copy of the DTD locally and refer to it.
-->
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<public publicId="-//W3C//DTD XHTML 1.0 Transitional//EN" uri="xhtml/xhtml1-transitional.dtd"/> <public publicId="-//W3C//DTD XHTML 1.0 Strict//EN" uri="xhtml/xhtml1-strict.dtd"/> <public publicId="-//W3C//DTD XHTML 1.0 Frameset//EN" uri="xhtml/xhtml1-frameset.dtd"/> <public publicId="-//W3C//ENTITIES Latin 1 for XHTML//EN" uri="xhtml/xhtml-lat1.ent"/> <public publicId="-//W3C//ENTITIES Symbols for XHTML//EN" uri="xhtml/xhtml-symbol.ent"/> <public publicId="-//W3C//ENTITIES Special for XHTML//EN" uri="xhtml/xhtml-special.ent"/>

<system systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"; uri="xhtml/xhtml1-transitional.dtd"/> <system systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"; uri="xhtml/xhtml1-strict.dtd"/> <system systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"; uri="xhtml/xhtml1-frameset.dtd"/> <system systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent"; uri="xhtml/xhtml-lat1.ent"/> <system systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent"; uri="xhtml/xhtml-symbol.ent"/> <system systemId="http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent"; uri="xhtml/xhtml-special.ent"/>
</catalog>


I've tested the catalog file and it works in other circumstances - like when I have a proper DOCTYPE declaration. There's also an environment variable that points to the catalog.

As a result, xmllint complains that the entities defined in the three files are invalid - which they have to be, of course, if it doesn't read the definitions.

Regards,
Lars

--
Lars Skjærlund
Skovengen 111
2980 Kokkedal
Denmark

Tlf.: +45 45 16 14 33

http://www.skjaerlund.dk/lars


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



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