Re: [xml] Problem with public entity references



On Tue, 2012-02-07 at 14:08 +0100, Nikolai Weibull wrote:
What is going wrong here?  (Example files minimized to show the problem.)

It looks like there are some bugs, however...

a.dtd:
<!ENTITY % a PUBLIC "-//a//b//c" "">

so the SYSTEM identifier of %a is actually "a.dtd", and system
identifers override public ones, so %a; includes a.dtd. I don't think
this is a bug.

If you change your DTD to use
<!ENTITY % a SYSTEM "boy">
and change the catalog to

<?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"
prefer="system">
  <system
    systemId="boy"
    uri="a.ent"/>
</catalog>

and use
SGML_CATALOG_FILES=catalog  xmllint --catalogs  --noout --dtdvalid a.dtd
a.xml localhost!lee ent> SGML_CATALOG_FILES=catalog  xmllint --catalogs
--dtdvalid a.dtd a.xml 

then it works.

The bug that I see is that if your system identifier is "-//a//b//c"
then xmllint doesn't obey the rewrite rule in the catalog, but tries to
open a file called "-/a/b/c" -- probably it is doing hierarchical URI
canonicalisation *before* checking the catalog.

In general, stay away from XML public identifiers if you can. They were
a mistaken feature in the spec, not needed at all, and will only cause
you problems!

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org




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