W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2005

Re: internal schema?

From: C. M. Sperberg-McQueen <cmsmcq@acm.org>
Date: 14 Dec 2005 07:30:26 -0700
To: nagarajank@huawei.com
Cc: xmlschema-dev@w3.org
Message-Id: <1134570625.2937.47.camel@localhost>

On Fri, 2005-12-09 at 04:03, Nagarajan K wrote:

>          In dtd we can have internal or external
>          type. What about schema. But schema is xml
>          document . can we have internal schema

In principle, yes.  The XML Schema 1.0 spec does not
constrain the set of locations where a processor can
look for schema documents, and carrying both a
payload to be validated and a set of schema documents
which describe it in the same XML envelope is certainly
legal.

In practice, there are a few complications:

1 Since the spec does not constrain how processors look
for schema documents, no processor is required to
understand any particular URI scheme or way of
referring to schema documents.

2 To point at inline schemas, you'll probably want to
use URIs which use fragment identifiers.  The official
definition of frgragment identifiers for XML documents
lags behind current practice by several years; although
many XML processors understand bare-name fragment
identifiers to refer to IDs, I am not sure whether the
relevant IETF documents actually require this.

And of course ID attributes can only be declared in a
DTD, and the designers of SOAP have decided that DTDs
must not be used in SOAP messages, so if you are
planning to use SOAP, you are in a bind.  

3 Normally, one would want to use inline schemas on
just the payload, not on the entire XML document.  From
the point of the view of the XML Schema 1.0 spec, this
is not a problem.  In practice, though, some schema
processors will only start schema validation at the
root of the XML document, and there is in any case no
standard way of telling them to start anywhere else.

4 Different processors which do support inline schemas
have different ways of finding them and allowing the
user to specify at invocation time that they should be
used.  It's been a long time since I looked into this,
but my recollection is that some processors required
points of one form, others required a different
(incompatible) form, and one processor simply assumed
that any schema document (i.e. xsd:schema element) in
the XML document should be used.

There was an attempt a couple of years ago to persuade
the XML Schema Working Group to form a task force to
investigate what current processors do and write a
short Note describing current practice (and possibly
recommending some common practice, if the WG could
agree on what to recommend), but some WG members
opposed any such Note and the idea went nowhere.


I hope this helps.

-C. M. Sperberg-McQueen
Received on Wednesday, 14 December 2005 14:31:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:51 GMT