Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Adding an attribute to a simple type? >Thread Next - Re: Adding an attribute to a simple type? Re: Adding an attribute to a simple type?To: NULL Date: 9/1/2004 9:23:00 PM You want complexType with simpleContent in order to do that. Use this: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:simpleType name="st"> <xs:restriction base="xs:string"> <xs:enumeration value="int8"/> <xs:enumeration value="int16"/> </xs:restriction> </xs:simpleType> <xs:element name="DataType"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="IsArray" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:schema> "iT_Ti" <tom.tempelaere@g...> wrote in message news:770409df.0409010555.502da852@p...... > Hi there, > > I'm trying to do something in an XSD that I think should be possible, > but that isn't. Giving a simple element an attribute. > > Basically what I tried is this (fragment): > > <xs:element name="DataType"> > <xs:simpleType> > <xs:restriction base="xs:string"> > <xs:enumeration value="int8"/> > <xs:enumeration value="int16"/> > </xs:restriction> > </xs:simpleType> > <xs:attribute name="IsArray" type="xs:string"/> > </xs:element> > > This is not a valid item (attribute not expected) and I don't see why. > It seems a logical way of saying this but it is not valid. > > Can someone tell me how I should write this? > > Thank you very much > Tom Tempelaere. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
