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

Help with an XSD problem

  • To: xml-dev@l...
  • Subject: Help with an XSD problem
  • From: helen.mauger@r...
  • Date: Fri, 1 Nov 2002 14:48:51 -0000
  • Return-receipt-to: helen.mauger@r...

xs date pattern
Title: Message
I am new to XSD and have spent about 3 hours trying to find out if what I want to do is possible
 
I have a stock element. This element has several child elements eg Currency, number and name. My problem is that I want (if possible to allow a choice re the type_of_stock. I want to limit it to either Equity or Bond - I have found two ways of doing this - either using enumeration or patterns. I have no preference as to which. However if they select BOND I want to force the user to input further elements eg the Interest_rate.
 
Is there any way of doing a test and if I see BOND in the type_of_stock element I ask for the extra elements - or am I trying to achieve the impossible via an automated process
 
<xs:element name="stock">
<xs:complexType>
<xs:sequence>
<xs:element name="Stock_Number"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:minLength value="1"/>
<xs:maxLength value="20"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Stock_Name">
.
.
</xs:element>
<xs:element ref="Currency">
</xs:element>
<xs:element name="types_of_stock" type="types_of_stock"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexTypename="types_of_stock">
<xs:all>
<xs:element name="Equity">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="EQUITY|BOND"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Bond">
<xs:complexType>
<xs:sequence> <xs:element name="Interest_rate">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:simpleType>
</xs:element>
<xs:element name="Issue_date" type="xs:date"/>
<xs:element name="Expiry_date" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
 

etc
 
Any suggestions gratefully received
 
Helen



_______________________________________________________________________


The information contained in this email is confidential and is intended

for the use of the addressee only. Any unauthorised dissemination or

copying of this email, and any use of disclosure of information

contained in it, is strictly prohibited and may be illegal.


Please let us know immediately by telephone if the email has been sent

to you in error (+44 1481 711166).

________________________________________________________________________


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.