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

Re: Defining a New Construct

From: Eddie Robertsson <erobertsson@allette.com.au>
Date: Fri, 26 Apr 2002 10:03:53 +1000
Message-ID: <3CC89969.56BF8FDA@allette.com.au>
To: Faiz A Currim <fcurrim@bpa.arizona.edu>
CC: xmlschema-dev@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:30 GMT