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

Re: How to do a choice on aggregation with w3C XML schema


schema choice
On Thu, 2003-12-18 at 09:14, John Cowan wrote:
> santony@b... scripsit:
> 
> > We need to essentially build a schema that will restrict the xml to
> > be in one of these 3 forms. Is it possible to do this at all.
> 
> Not in W3C XML Schema.  So if you need this kind of validation, get
> with the program and use RELAX NG, which is perfect for this kind of thing.
> Here's a (partial) RELAX NG schema, in compact notation, that will
> validate your documents:


Thanks a zillion John:
I also found out - to my surprise - unlike what I thought xml schema is
not the 'most powerful' and definitely not the 'solve anything' kind of
validator.

I m surprised why it does not have xslt like <xsl:if> constructs.

>From the standards this is what I violated
http://www.w3.org/TR/xmlschema-1/#non-ambig

Thanks again
--sony






> 
> start = command1 | command2 | command3
> 
> command1 = element COMMAND "REQUEST1",
> 	   element COMMAND_DATA {
> 		element REQ1_DAT1 {text},
> 		element REQ1_DAT2 {text},
> 		...
> 	   }
> 
> command2 = element COMMAND "REQUEST2",
> 	   element COMMAND_DATA {
> 		element REQ2_DAT1 {text},
> 		element REQ2_DAT2 {text},
> 		...
> 	   }
> 
> command3 = element COMMAND "REQUEST3",
> 	   element COMMAND_DATA {
> 		element REQ3_DAT1 {text},
> 		element REQ3_DAT2 {text},
> 		...
> 	   }
> 
> Now this assumes that you really do know how many REQi_DATj elements
> exist for each type; no extant schema language can help you much if you
> are allowed an arbitrary number of them.  The "..." is not part of RELAX
> NG syntax any more than it is of XML Schema.
> 
> > But though my xml editor ( xmlspy ) reported this to be a valid schema, 
> 
> XML Spy is notoriously unreliable at checking what is and what is not a
> valid XML Schema.  Indeed, no schema should be called valid unless it's
> been checked with several different validators.
> 
> > When I used xerces to validate I got an error like
> > 
> > "http://www.bellsouth.com/wfaif":COMMAND and
> > "http://www.bellsouth.com/wfaif":COMMAND (or elements from their
> > substitution group) violate "Unique Particle Attribution". During
> > validation against this schema, ambiguity would be created for those
> > two particles"
> 
> To XML Schema, your choice looks like "COMMAND | COMMAND | COMMAND", and
> it can't cope.  Differentiating on the content of the element is too subtle.
> RELAX NG, on the other hand, eats this stuff up.
> 
> You can find RELAX NG validators and other tools for various environments
> at http://www.relaxng.org .
> 
> Moral:  Don't define document types like this.  Let ordering do its
> natural work next time, instead of doubling up with ordering *and*
> magic element names.
-- 
Sony Antony <santony@b...>


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.