Re: [xml] Problem validating documents containing public entities with empty URIs



On Fri, Sep 10, 2010 at 02:52:17PM +0200, Nikolai Weibull wrote:
Hi!

Given the following files, invoking xmllint failes to validate a.xml,
instead spewing out the same couple of error messages over and over
again:

XML_CATALOG_FILES=catalog xmllint --valid a.xml

a.dtd:

<!ELEMENT a (b)>
<!ELEMENT b EMPTY>

a.xml:

<!DOCTYPE a PUBLIC "" "a.dtd" [
<!ENTITY b PUBLIC "b" "">
[...]

I failed to determine a way of solving this, though I only glanced at
the source.

  http://www.w3.org/TR/REC-xml/#sec-external-ent

[Definition: The SystemLiteral is called the entity's system identifier.
It is meant to be converted to a URI reference (as defined in [IETF RFC
3986]), as part of the process of dereferencing it to obtain input for
the XML processor to construct the entity's replacement text.]

If you look at RFC3986 you will see that and empty string is a correct
URI interpreted as an URI-Reference pointing to the containing document.

Hence using "" means 'this document' and the behaviour you are seing.

All normal, you asked for something foolish, and you got it :-)
Instead of trying to turn around thefact taht an URI is being needed
by trying to avoid it, define and URI, it's needed, it's mandated by the
XML specification (contrary to e.g. SGML).

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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