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

Re: restrictions of a complextype element

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Thu, 21 Jun 2001 10:30:23 +0200
Message-ID: <3B31B09F.3952331@dyomedea.com>
To: xmlschema-dev@w3.org
Eddie Robertsson wrote:
> Not really. To achieve what you try to do you first need to create a global
> simpleType for your base type like this:

You can do it like this, however, instead of extending a global
simpleType that you have created, you can also restrict the xs:string
like David was trying to do:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  <xs:element name="Test">
        <xs:restriction base="xs:string">
          <xs:enumeration value="hello world"/>
          <xs:enumeration value="this is me"/>
          <xs:attribute name="myAtt" type="xs:string" use="required"/>

(the xs:attribute needs to be inside the xs:restrict and not outside
xs:simpleContent as David had written).

Hope this helps.


Pour y voir plus clair dans la nebuleuse XML...
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
Received on Thursday, 21 June 2001 04:30:36 UTC

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