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

xml DOCTYPE and validation question



what follows is the output of xmllint run over a couple of different
documents.

this is docbook41.xml:
| <?xml version="1.0" encoding="utf-8"?>
| <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN" "docbook.dtd">
| <article lang="en"><title>hello</title><para>foobar</para></article>

this is docbook42.xml:
| <?xml version="1.0" encoding="utf-8"?>
| <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "docbook.dtd">
| <article lang="en"><title>hello</title><para>foobar</para></article>

the SGML_CATALOG_FILES environment variable is set to /etc/sgml/catalog.

$ xmllint --noout --valid --catalogs docbook42.xml; echo $?
0

$ xmllint --noout --valid --catalogs docbook41.xml; echo $?
docbook41.xml:2: error: failed to load external entity "docbook.dtd"
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1//EN" "docbook.dtd">
                                                                           ^
docbook41.xml:3: validity error: Validation failed: no DTD found !
<article lang="en"><title>hello</title><para>foobar</para></article>
                  ^
4

an interesting thing to note about the docbook42.xml file is that it
doesnt matter what the system identifier says, the document will still
validate. im assuming that libxml2 is matches the public identifier
first and does not worry about the system identifier.

in the case using the docbook41.xml file, setting the system identifier
to a valid url of the docbook 4.1 dtd causes the file to validate
properly. the causes me to think that libxml2 cannot match the public
identifier, and tries to match the system identifier only.

so, a couple of questions.

what is the system identifier supposed to mean if it is a relative url,
which is apparently allowed by the specification?

also, shouldnt the case 4.1 case work similar to the 4.2 case? what
exactly am i missing?

-- 
gram

Attachment: pgp1akJO3lpoy.pgp
Description: PGP signature


Reply to: