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



On Fri, Sep 10, 2010 at 03:22:20PM +0200, Nikolai Weibull wrote:
On Fri, Sep 10, 2010 at 15:12, Daniel Veillard <veillard redhat com> wrote:
On Fri, Sep 10, 2010 at 02:52:17PM +0200, Nikolai Weibull wrote:

Wow, that was a fast response!

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

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.

Aha, that explains a lot.  Thank you for taking the time to provide
such an enlightening, albeit at the same time stupefying, answer.

 yeah the "" URI reference trick sounds just fine from a Web point of
view but when used in a document processing context this led to a lot
of funny (or not) cornercases !

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).

This is a clientâs documents (well, the above was a simplified
example, but they send us documents that look like the one above).
Iâm just trying to validate them before I process them with xsltproc,
which also barfs on this crap.  I was hoping that I wouldnât have to
tell them to get serious and that I could get around it by using the
XML catalog trick to point xmllint and xsltproc to the right document.

So thereâs no way around this other than entering something as the URI?

  I'm afraid yes, as XPath requites to load the DTD for attribute
defaulting and types. You could try using the --novalid option
(the valid term is a bit improper there) to not load the external
subset of the DTD, but you're not garanteed to have the expected
behaviour.

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]