OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] How to do a choice on aggregation with w3C XML schema

[ Lists Home | Date Index | Thread Index ]

On Thu, 2003-12-18 at 09:14, John Cowan wrote:
> santony@bellsouth.net 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@bellsouth.net>





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS