Re: using redefine

"David Valera" <dvalera@pcl-hage.nl> writes:

> I am looking at the possibilities of using redefine in an XML schema. What I
> have seen from the primer, it is possible to add an element to a particular
> complexType, like this:
> 
> <redefine
>   schemaLocation="http://www.example.com/schemas/address.xsd">
> 
>   <!-- redefinition of Address -->
>   <complexType name="ipo:Address">
>    <complexContent>
>      <extension base="ipo:Address">
>       <sequence>
>        <element name="country" type="string"/>
>       </sequence>
>      </extension>
>    </complexContent>
>   </complexType>
> 
>  </redefine>
> 
> My question is, is it also possible to 'remove' elements that are declared
> in the ipo: Address.

Yes.

> Lets say address is:
> 
>  <complexType name="Address">
>   <sequence>
>    <element name="name"   type="string"/>
>    <element name="street" type="string"/>
>    <element name="city"   type="string"/>
>   </sequence>
>  </complexType>
> 
> I would like to have the possibility of redefining Address so that it only
> has two elements, 'name' and 'street'. element 'city' is no longer needed.
> Is this possible using redefine or do I have to stick to the possibilities
> of extension and restriction?

You must stick to extension and restriction.  So with the Address
above you're stuck, but if it had been

 <complexType name="Address">
  <sequence>
   <element name="name"   type="string"/>
   <element name="street" type="string"/>
   <element name="city"   type="string" minOccurs="0"/>
  </sequence>
 </complexType>

then the following would be OK

<redefine ...>
  <complexType name="Address">
   <complexContent>
    <restriction base="my:Address">
     <sequence>
      <element name="name"   type="string"/>
      <element name="street" type="string"/>
     </sequence>
    </restriction>
   </complexContent>
  </complexType>

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, 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/

Received on Friday, 22 December 2000 05:50:23 UTC