[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

HELP: XML-Schema - Array and Type Choice?

  • From: Risheng Lin <rlin@e...>
  • To: xml-dev@l...
  • Date: Mon, 04 Jun 2001 12:05:16 -0400

xml schema array
Dear member,

I have two more questions on XML-schema that need your help:


1. Is there any way to represent an array?

I know that the schema recommendation does not support this yet. But I want to find a best solution for this if possible. For example, my code has a variable:

   String title[numberOfTitle], where numberOfTitle is not known as a priori when schema author developed it. The numberofTitle is of type xsd:integer designed in schema, and its value will be given by user in an xml document instance, but when the user supplies this data, schema must validate that the maxOccurs can only be numberOfTitle data items.

How to design such an schema? In such a situation, do I have to resort to XPATH?




2. My second question is about type choice. Below is part of my schema:

<xsd:element name="DataValue">
        <!-- data can be either float or double-->
        <xsd:complexType>
           <xsd:choice>
                   <xsd:element name="Data" type="xsd:float" minOccurs="1" maxOccurs="unbounded"/>
                 <xsd:element name="Data" type="xsd:double" minOccurs="1" maxOccurs="unbounded"/>
           </xsd:choice>
           <xsd:attribute ref="dataType" use="required" />
        </xsd:complexType>
</xsd:element>

But I want more constraints on this schema --- when user supplies the attribute dataType to be "float", the schema will only allow the instance document to supply Data Element to be of type xsd:float; on the other hand, if attribute dataType is "double", the XML document can only supply Data Element of type xsd:double?   



Many thanks,


Risheng

-----------------------------------------------------


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.