Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: 'all' must only appear as the content type of a complex type definition?

From: George Cristian Bina <george@---------.--->
To: Scott Lawrence <slawrence@-------.--->
Date: 1/5/2005 1:29:00 PM
Hi Scott,

The schema is invalid as reported by the parser. The relevant part of 
the specification is here:
http://www.w3.org/TR/xmlschema-1/#cos-all-limited

The closest you can get I guess is to use a choice model instead of all.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


Scott Lawrence wrote:
> I'm trying to develop a schema for an existing XML usage (for which no
> schema or DTD was ever written before).  I've run into a case that I
> can't get Xerces-C to validate, and am not sure whether my schema
> construction or the parser validation is the problem.  I've put together
> a simplified version ...
> 
> The short statement of the problem is that I have an element 'address'
> whose content may be either the single element 'url' or any combination
> of the elements 'user', 'host', and 'qual'.  I tried to express this as:
> 
>   <group name='parts'>
>     <all>
>       <element ref='dmp:user' minOccurs='0' maxOccurs='1'/>
>       <element ref='dmp:host' minOccurs='0' maxOccurs='1'/>
>       <element ref='dmp:qual' minOccurs='0' maxOccurs='1'/>
>     </all>
>   </group>
> 
>   <element name='address'>
>     <complexType>
>       <choice>
>         <group   ref='dmp:parts'/>
>         <element ref='dmp:url'/>
>       </choice>
>     </complexType>
>   </element>
> 
> When I try to validate a document against the above (using either
> xerces-c version 2.5 or 2.6), I get:
> 
> ======
> 
>>DOMCount -v=always -s -f -n either.xml
> 
> 
> Error at file file:///home/lawrence/tmp/groupall/either.xsd, line 24,
> char 35
>   Message: A group whose content is 'all' must only appear as the
> content type of a complex type definition.
> ======
> 
> Should the above work?  Is there a (better) way to accomplish what I'm
> after?  (I attached a complete version of the above schema, and what I
> think should be a valid instance)
> 
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version='1.0' encoding='iso-8859-1' standalone='yes'?>
> <schema
>     xmlns:dmp='http://www.sipfoundry.org/sipX/test-00'
>     targetNamespace='http://www.sipfoundry.org/sipX/test-00'
>     xmlns='http://www.w3.org/2001/XMLSchema'
>     >
> 
>   <element name='url' type='normalizedString' />
>   <element name='user' type='normalizedString' />
>   <element name='host' type='normalizedString' />
>   <element name='qual' type='normalizedString' />
> 
>   <group name='parts'>
>     <all>
>       <element ref='dmp:user' minOccurs='0' maxOccurs='1'/>
>       <element ref='dmp:host' minOccurs='0' maxOccurs='1'/>
>       <element ref='dmp:qual' minOccurs='0' maxOccurs='1'/>
>     </all>
>   </group>
> 
>   <element name='address'>
>     <complexType>
>       <choice>
>         <group   ref='dmp:parts'/>
>         <element ref='dmp:url'/>
>       </choice>
>     </complexType>
>   </element>
> 
>   <element name='addresses'>
>    <complexType>
>     <sequence>
>      <element ref='dmp:address' maxOccurs='unbounded' />
>     </sequence>
>    </complexType>
>   </element>
> 
> </schema>
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version='1.0' encoding='iso-8859-1' standalone='yes'?>
> <addresses xmlns='http://www.sipfoundry.org/sipX/test-00'
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://www.sipfoundry.org/sipX/test-00
> file:///home/lawrence/tmp/groupall/either.xsd"
> 
> 
>   <address>
>     <url>foo@bar;batz=3</url>
>   </address>
> 
>   <address>
>     <user>foo</user>
>   </address>
> 
>   <address>
>     <user>foo</user>
>     <host>bar</host>
>   </address>
> 
> </addresses>
> 
> 

From mike@s... Wed Jan 05 10:05:33 2005
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3.org with esmtp (Exim 4.34)
	id 1Cm82n-0000Vh-DB
	for xml


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