Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Adding an attribute to a simple type? [Thread Next] Re: Adding an attribute to a simple type?To: NULL Date: 9/2/2004 2:25:00 AM Hi, Indeed, I need to specify the simpleType 'st' as extension-base in the simpleContent. Thanks for the hint Zafar, Tom. "TT (Tom Tempelaere)" wrote: > Hi Zafar, thanks for the reply. > > I don't see the link between the complexType and the simpleType in your code > sample. The simpleType "st" you defined is not used further on. Just guessing > (and will be trying), but do I need to reference the simple type in the > simpleContent specification of DataType element? > > Thanks, > Tom T. > > "Zafar Abbas [MSFT]" wrote: > > > 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 | |||
|
