W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2001

Re: How to define an element with attribute

From: Eddie Robertsson <eddie@allette.com.au>
Date: Fri, 30 Mar 2001 17:02:24 +1000
Message-ID: <3AC42F80.DCEBAA2E@allette.com.au>
To: Wang K H <khong.hai.wang@gridnode.com>
CC: xmlschema-dev@w3.org

Wang K H wrote:

> Hi all, I am new to schema and is trying to write a schema. Please
> refer to the example below :<Value POSITION="4">PART</Value>
> How do I define the schema for the above element?
> Right now, I am writing as :
> <xsd:element name="Value" minOccurs="0" maxOccurs="unbounded">
> <xsd:complexType>
> <xsd:attribute name="POSITION" type="xsd:positiveInteger"
> use="optional"/>
> </xsd:complexType>
> </xsd:element>

<xsd:element name="Value" minOccurs="0" maxOccurs="unbounded">
         <xsd:extension base="xsd:string">
            <xsd:attribute name="POSITION" type="positiveInteger"

This will give you the element definition you want and in this case the
content of element Value is of type xsd:string.

Received on Friday, 30 March 2001 02:01:38 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:51 UTC