W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2003

[xmlschema-dev] <none>

From: marco anyway <marcoanyway@hotmail.com>
Date: Mon, 26 May 2003 16:27:44 +0000
To: xmlschema-dev@w3.org
Message-ID: <Law12-F51TQGYbXhNoR000168ef@hotmail.com>
Hi,

I'd like to insert an attribute that counts the number of element in a 
SEQUENCE.
Is there a way to do this inside XML Schema? The idea is to verify, during 
the validation phase of the XML document, if the value of this attribute 
corresponds to the actual number of elements of the sequence.

Example:

<xsd: element name = "song" type="xsd:string"/>

<xsd:attribute name="songCount" type=???????/>

<xsd: element name = "songCollection" >
<xsd:complexType>
  <xsd: sequence>
    <xsd: element ref=song"/>
  </xsd: sequence>
  <xsd:attribute ref="songCount"/>
</xsd:complexType>
</xsd: element>

I'd like that the following XML doc would be validated:

<songCollection songCount=3>
  <song>let me breathe<song/>
  <song>pull me under<song/>
  <song>another day <song/>
</songCollection>

and the following would not:

<songCollection songCount=8>
  <song>let me breathe</song>
  <song>pull me under</song>
  <song>another day </song>
</songCollection>



Thanks to all who can help!

Marco

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail
Received on Monday, 26 May 2003 12:32:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:37 GMT