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

Re: Modelling problem


modelling problem
You don't say what schema language (or DTD?) you are working with. It is 
cumbersome to express these constraints without order in DTD or XML 
Schema. XML Schema's 'all' will not allow more than once. You would be 
forced to write out the alternatives by hand. For example, for three 
required elements a, b and c, without order.

(a,((b,c)|(c,b)))
|(b,((a,c)|(c,a)))
|(c,((a,b)|(b,a)))

(The DTD-style notation would need to be translated into the much 
bulkier XML Schema syntax.)

When all of the alternatives are optional and some can be repeated, more 
thought is required but the pattern is the same. For example, suppose a 
can occur only once, b and c more than once.

((a,((b+,c*)|(c+,b*))?)
|(b,((a,c*)|(c+,a))?)
|(c,((a,b*)|(b+,a))?))?

Note that the number of subexpressions expands exponentially as the 
number of subelements increases.

In RELAX NG, however, this would be trivial to write. The following is 
in the RELAX NG compact syntax:

a? & b* & c*

Bob Foster
http://xmlbuddy.com/

Ben Ryan wrote:
 > All,
 > 	Apologises if this is the wrong list to post to. Please could
 > someone advise if there is a more appropriate list.
 >
 > 	I am trying to model the following:
 >
 > 	An element has a number of subelements that are not ordered.
 > 	All of these subelements are optional.
 > 	Certain of the subelements can occur more than once.
 > 	Ceratin of the subelements can only occur once.
 >
 > 	If I use a choice model I need to make it unbounded to allow the
 > occurrence of more than one subelement.
 > 	If I do this then all the subelements can occur more than once.
 >
 > 	I can work around this using sequence models but the standard am
 > I following does not specify order.
 >
 > 	Any help would be appreciated.
 >
 > Regards,
 > 	Ben
 >
 > ---------------------------------
 > Dr Ben Ryan
 > HLSI Software Development Manager
 > University of Huddersfield
 > Tel: 01484 473587
 > E-mail: b.ryan@h...
 > ---------------------------------


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.