W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2000

Re: Root element/ association of a schema targetNamespaceof to an instance/ maxOccurs.

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 02 Jun 2000 14:43:15 +0100
To: S_PERROTT <Simon.Perrott@reuters.com>
Cc: www-xml-schema-comments@w3.org
Message-ID: <f5bya4o8ah8.fsf@cogsci.ed.ac.uk>
S_PERROTT <Simon.Perrott@reuters.com> writes:

> 1) Root elements.

> I understand that a schema can have several global elements of
> complexType. Is there any way for a schema to indicate which of its
> elements will be the root element in instance documents? (The way
> that the DTD !DOCTYPE declaration does). If not how can you tell
> what starts off an instance?

Just as in XML 1.0 this is an issue not for DTDs as such (the identity 
of the document element is not specified in either internal or
external subset) we decided that it's not a matter for schemas as
such.  Also, again as in XML 1.0, one can specify external to the
schema, in the invocation of schema processing, a top-level element
declaration or type to begin validation with.  This fulfills the
specified requirement.

> 2) Association of a schema to an instance.

> I am confused about the relationship between schemas and
> namespaces. An instance document may declare several namespaces in
> its root element. I understand this to mean that the instance uses
> components in several schemas whose target namespaces are referenced
> in the instance.  But is there a notion that the instance is based
> on one schema that itself uses parts of other schemas? If so, how
> can you tell which of the namespaces in an instance contains this
> schema upon which the instance is mostly based?

The distinction between schemas (abstract types, composed of schema
components, some perhaps with different target namespaces than others) 
and schema documents (concrete XML documents, single target namespace, 
may refer to components from schemas corresponding to schema documents 
with other target namespaces.

Consider the two-namespace case:  at least three possibilities arise:

1) Two schema documents, one for each namespace, no <import>s at all,
judicious use of <any/>, the instance (or the schema-validator) must
locate both schema documents to construct the schema which can do the

2) Two schema documents, one for each namespace, one <import>s the
other and makes explicit reference to components from it, the instance
(or the schema-validator) may locate first the <import>ing and then,
thereby, the <import>ed;

3) Two schema documents, one for each namespace, each <import>s the
other and each makes explicit reference to components from the other,
the instance (or the schema-validator) may locate first one
and then, thereby, the other.

> 3) maxOccurs

> Quoting from the definition of maxOccurs: "{max occurs} unbounded,
> if the maxOccurs [attribute] equals unbounded, otherwise the numeric
> lexical [value] of the maxOccurs [attribute], if present, otherwise
> the lexical [value] of the minOccurs [attribute], if present,
> otherwise 1. "

> Section 2.2 of the primer states this as "there is no default value for
> maxOccurs per se: When an element is declared without a maxOccurs attribute,
> the maximum number of the element's occurrences is equal to the value of the
> minOccurs attribute."

Known bug, will be corrected in Part 1 to 'if present and non-zero'
and brought in to line in Part 0.

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Friday, 2 June 2000 09:43:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:47 UTC