Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XSD Schema Authoring Question

From: "P. Lepin" <lepin@---------.--->
To: NULL
Date: 2/5/2008 10:09:00 PM


Mike wrote:
> <foo>
>   <bar/>
>   <bar/>
>   <baz/>
>   <bar/>
> </foo>
> 
> and
> 
> <foo>
>   <baz/>
> </foo>
> 
> would both match
> 
> <xs:element name="foo">
>   <xs:complexType>
>     <xs:all>
>       <xs:element name="bar" minOccurs="0" maxOccurs="unbounded" />
>       <xs:element name="baz" />
>     </xs:all>
>   </xs:complexType>
> </xs:element>
> 
> except of course for the fact that maxOccurs can only be "1" in
> <xs:all>.
> 
> Do you see what I mean?  I want to specify that these particular
> children elements can occur in their parent, in no particular (known
> to the schema) order, each with their own possibly unbounded
> cardinality.  No other types of children can occur, and I want a
> validating parser to keep track of the cardinality of the children to
> ensure they're not happening too (in)frequently.

I believe this isn't possible. Either specify a strict ordering of elements
(xs:sequence), or allow any number of applicable elements (xs:choice with
minOccurs/maxOccurs). Check semantics on the application-side if necessary,
and/or use a more powerful schema definition language. W3C's XML Schema
Definition Language was not designed to define arbitrarily complex
grammars.

> There must be a way to do this, I just can't figure out how.  Any help
> much appreciated!

The fact that you want to do something doesn't yet mean it's possible.

-- 
Presented in Brain Control where available.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent