Re: Validation rules for a complexType

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

No

> or children

Yes

> 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
component.

> 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

ht
-- 
  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