Re: Is this test case invalid (implicit derivation from ur-type / attribute wildcards)

Hi Stefan,

> in the Sun test suite there is a schema (xsd002.xsd) that derives types
> implicitly from the ur-type:
>
>         <xsd:element name="root">
>                 <xsd:complexType>
>                         <xsd:choice maxOccurs="unbounded">
>                                 <xsd:element name="foo" />
>                                 <xsd:element name="bar" form="qualified" />
>                                 <xsd:element name="zot" form="unqualified" />
>                         </xsd:choice>
>                 </xsd:complexType>
>         </xsd:element>

OK, this is equivalent to:

<xsd:element name="root">
  <xsd:complexType>
    <xsd:choice maxOccurs="unbounded">
      <xsd:element name="foo" type="xs:anyType" />
      <xsd:element name="bar" form="qualified" type="xs:anyType" />
      <xsd:element name="zot" form="unqualified" type="xs:anyType" />
    </xsd:choice>
  </xsd:complexType>
</xsd:element>

If an element declaration doesn't have an explicit type attribute nor
a nested anonymous complex type, then it is of the ur-type definition
itself.

> In the instance document the element "zot" has attributes:
>
> <f:root xmlns:f="http://foo.com">
>         <foo>
>                 <this />
>                 <contents />
>                 should not be
>                 validated
>                 <because it="is ur-type" />
>         </foo>
>         <f:bar />
>         <zot attributes="are" also="ignored">
>                 when using <ur><type/></ur>
>         </zot>
> </f:root>
>
> I think that this test case is incorrect because an implicit
> derivation is a short-hand for restricting the ur-type. Though the
> ur-type has an attribute wildcard (namely <anyAttribute/>) this
> wildcard is not inherited by complex type restrictions.

I think that you've misinterpreted what's going on here. The type of
the element "zot" *is* the ur-type definition, not a restriction of
the ur-type definition.

If you were talking about the f:root element, then you'd be right that
if it had an attribute on it, it would be an error because the
anyAttribute whildcard isn't inherited when you restrict a complex
type.

Have I missed something?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Thursday, 15 August 2002 06:37:19 UTC