- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 15 Nov 2000 15:32:44 +0000
- To: Reinier Bos <rbos@baan.nl>
- Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Reinier Bos <rbos@baan.nl> writes:
> I'm wondering whether I'd be able to (validly) use the following schema:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema targetNamespace="http://www.baan.com/xyz"
> xmlns:xyz="http://www.baan.com/xyz"
> xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
>
>
> <!-- Extend the default element with an 'x' attribute -->
> <xsd:complexType name="element">
> <xsd:complexContent>
> <xsd:extension base="xsd:element">
> <xsd:attribute name="x" type="xsd:boolean" use="default"
> value="false"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
> </xsd:schema>
This isn't quite what you want, for two reasons:
1) You haven't redefined xsd:element, you've defined a new type
called xyz:element, which is not the type of any element (so far);
2) The schema for XML Schemas has the 'blockDefault' attribute set to
'#all', which means you can't use any types you derive from type
defined therein.
> I was hoping that this would allow me to write something like this in
> another schema:
>
> .
> .
> .
> <xsd:sequence>
> <xyz:element name="..." x="true"/>
> <xsd:sequence>
> .
> .
You can already do very nearly that, without going to all this
trouble. The schema for XML Schema derives almost all types from a
type which contains <anyAttribute namespace="##other"/>, so the
following is already acceptable without _any_ extra declarations:
<xsd:sequence>
<xsd:element name="..." xyz:x="true" .../>
</xsd:sequence>
Hope this helps.
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 Wednesday, 15 November 2000 10:32:53 UTC