Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Element Takes Enumerated List but has Attribute that Takes a String [Thread Next] RE: Element Takes Enumerated List but has Attribute that Takes a StringTo: "'Fortuno, Adam'" <Adam_Fortuno@----------.--->, <xmlschema-dev@--.---> Date: 12/19/2006 2:57:00 PM
You want something like this:
<xs:element name="Foo">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="xs:token">
<xs:enumeration value="ABC" />
<xs:enumeration value="123" />
<xs:enumeration value="DEF" />
</xs:restriction>
</xs:simpleContent>
<xs:attribute name="_Code" type="xs:string"/>
</xs:complexType>
</xs:element>
ALternatively you can define the type of Foo as an extension of FooType
(extended by adding an attribute)
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: xmlschema-dev-request@w...
> [mailto:xmlschema-dev-request@w...] On Behalf Of Fortuno, Adam
> Sent: 15 December 2006 19:26
> To: xmlschema-dev@w...
> Subject: Element Takes Enumerated List but has Attribute that
> Takes a String
>
>
> All,
>
> I'm trying to create the below structure
>
> <Foo _Code="XYZ">ABC</Foo>
>
> Where the element `Foo` takes a literal value from an
> enumerated list, and the attribute `_Code` takes a
> (xs:)string. I have tried a few different constructs based on
> research I've done. I can get the enumerated list for the
> element but not the attribute or vice versa.
>
> Any suggestions would be appreciated. Here is what I've tried
> (doesn't work).
>
> <xs:element name="Foo" type="FooType">
> <xs:complexType>
> <xs:attribute name="_Code" type="xs:string"/>
> </xs:complexType>
> </xs:element>
> <xs:simpleType name="FooType">
> <xs:restriction base="xs:token">
> <xs:enumeration value="ABC" />
> <xs:enumeration value="123" />
> <xs:enumeration value="DEF" />
> </xs:restriction>
> </xs:simpleType>
>
> Regards,
> Adam
>
>
From noah_mendelsohn@u... Tue Dec 19 15:11:04 2006
Received: from maggie.w3.org ([193.51.208. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
