Re: restrictions of a complextype element

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"
elementFormDefault="qualified">
  <xs:element name="Test">
    <xs:complexType>
      <xs:simpleContent>
        <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"/>
        </xs:restriction>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
</xs:schema>

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

Hope this helps.

Eric

-- 
Pour y voir plus clair dans la nebuleuse XML...
                                          http://dyomedea.com/formation/
------------------------------------------------------------------------
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