W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2001

Using element groups to define multiple types for the same element

From: <Mike_Leditschke@nemmco.com.au>
Date: Sat, 19 May 2001 02:13:35 +1000
To: xmlschema-dev@w3.org
Message-ID: <OFEA1FE101.824DB8BD-ON4A256A50.005740A3@nemmco.com.au>
The schema below validates ok with XMLSpy, and allows the "subelement" to
have variable
content (string/date/number).

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema" targetNamespace
="test" xmlns="test">
  <xsd:group name="group1">
      <xsd:element name="subelement" type="xsd:string"/>
  <xsd:group name="group2">
      <xsd:element name="subelement" type="xsd:number"/>
  <xsd:group name="group3">
      <xsd:element name="subelement" type="xsd:date"/>
  <xsd:element name="test">
        <xsd:group ref="group1"/>
        <xsd:group ref="group2"/>
        <xsd:group ref="group3"/>

Is this a valid schema? Will it validate all the following instances ok
(ignoring namespace stuff)?






If so, does a group definition provide some type of "local" scoping of the
subelement content model such that the above doesn't cause conflicts?

It just didn't look/feel right to me.

Received on Friday, 18 May 2001 12:14:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:51 UTC