I have written a servlet wrapper and a custom entity resolver for
Jing.[1] My code needs to decide whether to instantiate a compact syntax
schema reader or an XML syntax schema reader. I would very much like to
do the Right Thing. Currently, my code does the following;
1. If the HTTP Content-Type of the schema is
application/vnd.relax-ng.rnc, the schema is treated as a compact syntax
schema.
2. If the HTTP Content-Type of the schema is application/octet-stream,
the UA may guess. The implemented guess is that the schema is treated as
a compact syntax schema if its URL ends with ".rnc".
3. If the user has requested lax treatment of HTTP Content-Type and the
HTTP Content-Type is text/plain, the schema is treated as a compact
syntax schema if its URL ends with ".rnc".
In all cases, the charset parameter is supported for overriding the RNC
default UTF-16/UTF-8 sniffing. (I consider the charset parameter
harmful, but the RNC spec specifically blesses it.)
However, it seems the registration of application/vnd.relax-ng.rnc went
nowhere and the type is not official. Can anyone suggest a more correct
way of deciding if a schema acquired via HTTP should be treated as a
compact syntax schema?
(I'm inclined the consider the media type system in general and the
registration procedure in particular dysfunctional.. . It seems to me
that most .rng and .rnc schemas out there are served as text/plain.)
[1] http://hsivonen.iki.fi/validator/
--
Henri Sivonen
hsivonen@iki.fi
Jing.[1] My code needs to decide whether to instantiate a compact syntax
schema reader or an XML syntax schema reader. I would very much like to
do the Right Thing. Currently, my code does the following;
1. If the HTTP Content-Type of the schema is
application/vnd.relax-ng.rnc, the schema is treated as a compact syntax
schema.
2. If the HTTP Content-Type of the schema is application/octet-stream,
the UA may guess. The implemented guess is that the schema is treated as
a compact syntax schema if its URL ends with ".rnc".
3. If the user has requested lax treatment of HTTP Content-Type and the
HTTP Content-Type is text/plain, the schema is treated as a compact
syntax schema if its URL ends with ".rnc".
In all cases, the charset parameter is supported for overriding the RNC
default UTF-16/UTF-8 sniffing. (I consider the charset parameter
harmful, but the RNC spec specifically blesses it.)
However, it seems the registration of application/vnd.relax-ng.rnc went
nowhere and the type is not official. Can anyone suggest a more correct
way of deciding if a schema acquired via HTTP should be treated as a
compact syntax schema?
(I'm inclined the consider the media type system in general and the
registration procedure in particular dysfunctional.. . It seems to me
that most .rng and .rnc schemas out there are served as text/plain.)
[1] http://hsivonen.iki.fi/validator/
--
Henri Sivonen
hsivonen@iki.fi