Re: Included <schema>

George Cristian Bina writes:

> I always thought that an included schema document may refer to
> components that are defined in the including <schema> even if they are
> not directly reachable if we start from the included schema.

True, IMO.

> Now, the spec says in http://www.w3.org/TR/xmlschema-1/#src-include:
> ***
> Schema Representation Constraint: Inclusion Constraints and Semantics
> In addition to the conditions imposed on <include> element information
> items by the schema for schemas, all of the following must be true:
> 1 If the ·actual value· of the schemaLocation [attribute] successfully
> resolves one of the following must be true:
> 1.1 [...]
> 1.2 It resolves to a <schema> element information item in a
> well-formed information set, which in turn corresponds to a valid
> schema.
> ***
>
> Does this "which in turn corresponds to a valid schema" mean that the
> above schema starting from test.xsd should be considered invalid
> because m.xsd is not valid itself?

Ah, but m.xsd _is_ valid.  The open reference (to 'a') does not render
the schema invalid.  Just as in DTDs, including an element (ref.) in a
content model is only an error if you need it to validate a particular
part of an instance:

  Note: The pervasive impact of redefinition reinforces the need for
  implementations to adopt some form of lazy or 'just-in-time'
  approach to component construction, which is also called for in
  order to avoid inappropriate dependencies on the order in which
  definitions and references appear in (collections of) schema
  documents.

  When schema components are constructed from XML representations
  involving reference by name to other components, this assumption may
  be violated if one or more references cannot be resolved. This
  specification addresses the matter of missing components in a
  uniform manner, described in Missing Sub-components (§5.3): no
  mention of handling missing components will be found in the
  individual component descriptions below.

  [M]ost kinds of schema components have properties which are
  described ... as having other components, or sets of other
  components, as values, but that when components are constructed on
  the basis of their correspondence with element information items in
  schema documents, such properties usually correspond to QNames, and
  the ·resolution· of such QNames may fail, resulting in one or more
  values of or containing ·absent· where a component is mandated.
  [I.e. it's a validation-time error, not a schema error.]

ht
-- 
       Henry S. Thompson, School of Informatics, University of Edinburgh
      10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
                Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                       URL: http://www.ltg.ed.ac.uk/~ht/
 [mail from me _always_ has a .sig like this -- mail without it is forged spam]

Received on Tuesday, 12 February 2013 11:04:49 UTC