W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

Re: Validation rules for a complexType

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 02 Jul 2002 21:16:15 +0100
To: John Verhaeg <jverhaeg@metamatrix.com>
Cc: "XML Schema Mailing List (E-mail)" <xmlschema-dev@w3.org>
Message-ID: <f5bpty5j374.fsf@cogsci.ed.ac.uk>

John Verhaeg <jverhaeg@metamatrix.com> writes:

> It appears to me from looking at the spec that whenever you derive a
> complexType from another complexType as a restriction, you have to
> re-declare any attributes


> or children


> from the supertype in the subtype if you want them to be available
> in the subtype.  Is this true?  If so, it seems like when validating
> an instance of the subtype, I need look no farther than the subtype
> itself (i.e., I don't need to traverse the type hierarchy to see
> what's valid).

Careful -- you're confusing XML representions with components.  A type
definition component always has everything it needs for validation to
hand.  The XML representation has all the content model (leaving model
group refs aside), but may have to 'inherit' attribute decls from up
the derivation chain in the course of constructing that complete

> Also, what's the difference in this scenario between not re-declaring a
> child

It goes away, provided it was optional higher up (otherwise it's an error).

> or attribute

it's 'inherited'

> and declaring a child with maxOccurs=0

it goes away, provided it was optional higher up (otherwise it's an error).

> or an attribute with use="prohibited"

it goes away, provided it was optional higher up (otherwise it's an error).

> Finally, where in the spec, if anywhere, are these questions answered?

In the discussion of mapping from the XML representations of complex
type definitions to the corresponding component, in section 3.3

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, 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/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Tuesday, 2 July 2002 16:16:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC