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

RE: simple attribute question

From: Priscilla Walmsley <priscilla@walmsley.com>
Date: Wed, 11 Aug 2004 16:17:52 -0400
To: "'Rob Harrington'" <robot252@yahoo.com>, <xmlschema-dev@w3.org>
Message-ID: <E1BuzYV-0006Bc-IS@frink.w3.org>

Hi,

Try:

<xsd:complexType name="itemType">
  <xsd:simpleContent>
  	<xsd:extension base="xsd:positiveInteger">
	  <xsd:attribute name="sometext" type="xsd:string"/>
  	</xsd:extension>
  </xsd:simpleContent>
</xsd:complexType>

<xsd:element name="item" type="itemType"/>

Hope that helps,
Priscilla
-----------------------------------------------------
Priscilla Walmsley             priscilla@walmsley.com
Author, Definitive XML Schema     (Prentice Hall PTR)
-----------------------------------------------------  

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Rob Harrington
> Sent: Wednesday, August 11, 2004 2:25 PM
> 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 Wednesday, 11 August 2004 20:18:39 UTC

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