Re: Defining a New Construct

Hi Faiz,

> Is it possible to define a new construct (i.e. like "element",
> "attribute" ...) using XSchema that extends one of the old constructs?

Yes, but keep in mind that you do in fact extend the _types_ of the elements
and attributes, not the actual element or attribute itself.

> >From what i've been able to determine, this is done in the XSchema
> definition itself in the following way:
>
> <xs:complexType name="element" abstract="true" mixed="false">
>   <xs:complexContent>
>     <xs:extension base="xs:annotated">
>       <xs:sequence>
>         ...
> so it would seem that "element" extends "annotated".

Correct.

> However if i try to extend "element" in an external .xsd file - using a
> similar style as above:
> <xs:complexType name="myElement" abstract="true" mixed="false">
>   <xs:complexContent>
>     <xs:extension base="xs:element">
>       <xs:sequence>
>         ...
>
> the validator always stops me with an "xs:element is an invalid value for
> the extension base".

This is because you can't extend the element itself. Instead you have to
extend the type of xs:element.

Cheers,
/Eddie

Received on Thursday, 25 April 2002 19:52:05 UTC