[XOM-interest] Bug: XOM's rules for system ids are too stringent
Elliotte Rusty Harold
elharo at metalab.unc.edu
Thu Feb 21 12:33:37 EST 2008
John Cowan wrote:
> Currently, XOM throws an error if the system identifier in a DOCTYPE
> declaration is not a well-formed URI. But that's too stringent: the
> XML Recommendation says that a system identifier has to be *convertible*
> to a well-formed URI by escaping inappropriate characters. The ipsissima
> verba are in Section 4.2.2 of XML 1.0:
>
> System identifiers (and other XML strings meant to be used as URI
> references) may contain characters that, according to [IETF RFC
> 3986], must be escaped before a URI can be used to retrieve the
> referenced resource. The characters to be escaped are the control
> characters #x0 to #x1F and #x7F (most of which cannot appear in
> XML), space #x20, the delimiters '<' #x3C, '>' #x3E and '"' #x22,
> the unwise characters '{' #x7B, '}' #x7D, '|' #x7C, '\' #x5C,
> '^' #x5E and '`' #x60, as well as all characters above #x7F.
>
At first glance, this appears to be another incompatible change
introduced as an erratum; this time in the 3rd edition of XML 1.0. In
the 2nd edition I find this text instead:
[Definition: The SystemLiteral is called the entity's system identifier.
It is a URI reference (as defined in [IETF RFC 2396], updated by [IETF
RFC 2732]), meant to be dereferenced to obtain input for the XML
processor to construct the entity's replacement text.] It is an error
for a fragment identifier (beginning with a # character) to be part of a
system identifier. Unless otherwise provided by information outside the
scope of this specification (e.g. a special XML element type defined by
a particular DTD, or a processing instruction defined by a particular
application specification), relative URIs are relative to the location
of the resource within which the entity declaration occurs. A URI might
thus be relative to the document entity, to the entity containing the
external DTD subset, or to some other external parameter entity.
Thus the system identifier is a URI, not merely a string that is
converted to a URI. It is an error for a URI to contain an unescaped
linefeed, and XOM should throw an exception in that case.
If I misread you and XOM is disallowing a properly escaped linefeed in a
URI, then that may be a bug I'll have to look at.
--
Elliotte
More information about the XOM-interest
mailing list