W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2004

RE: simple attribute question

From: <Simon.Cox@csiro.au>
Date: Thu, 12 Aug 2004 18:05:03 +0800
Message-ID: <2A2B2F12CF99EA4A898E2D4729441B41BE06B2@exwa2-per.wa.csiro.au>
To: <mhk@mhk.me.uk>, <robot252@yahoo.com>, <xmlschema-dev@w3.org>

SLight correction:

<xs:complexType>
   <xs:simpleContent>
     <xs:extension base="xs:integer">
       <xs:attribute name="sometext"/>
     </xs:extension>
   </xs:simpleContent>
 </xs:complexType> 


> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Michael Kay
> Sent: Thursday, 12 August 2004 3:43 AM
> To: 'Rob Harrington'; xmlschema-dev@w3.org
> Subject: RE: simple attribute question
> 
> 
> What you want is a "complex type with simple content"
> 
> <xs:complexType>
>   <xs:simpleContent>
>     <xs:extension base="xs:integer"/>
>     <xs:attribute name="sometext"/>
>   </xs:simpleContent>
> </xs:complexType> 
> 
> I find the syntax extremely unmemorable (and might have got 
> it wrong) - all my instincts are to say that the attributes 
> aren't part of the simple content, so they should go outside 
> the xs:simpleContent element - but that's the way it is. 
> 
> Michael Kay
> 
> > -----Original Message-----
> > From: xmlschema-dev-request@w3.org
> > [mailto:xmlschema-dev-request@w3.org] On Behalf Of Rob Harrington
> > Sent: 11 August 2004 19:25
> > To: xmlschema-dev@w3.org
> > Subject: simple attribute question
> > 
> > 
> > Newbie here.  Apologies in advance if this isn't the 
> correct forum - 
> > if so please advise where I can take this question.
> > 
> > In my schema definition, I simply want to express this
> > xml:
> > 
> > <item sometext="attributeText">9899</item>
> > 
> > where 9899 is a positive integer.
> > 
> > in the schema, it seems I can't declare this structure, the 
> best I can 
> > get to is something like
> > this:
> > 
> > <item sometext="attributeText">
> >   <someIdTagIDontWant>9899</someIdTagIDontWant>
> > </item>
> > 
> > Here's what would get me that:
> > 
> > <complexType name=itemType>
> >   <sequence>
> >     <element name=someIdTagIDontWant
> > type=type="xs:long"/>
> >   </sequence>
> >   <attribute name="sometext" type="xsd:string"/> </complexType>
> > 
> > <element name="item" type="itemType"/>
> > 
> > Is this correct, or have I not dug deep enough?  I really 
> don't want 
> > the someIdTagIDontWant.
> > 
> > Thanks.
> > 
> > 
> > 		
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - Helps protect you from nasty viruses.
> > http://promotions.yahoo.com/new_mail
> > 
> > 
> > 
> 
> 
> 
Received on Thursday, 12 August 2004 10:05:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:10 UTC