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

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

From: Scott Lawrence <slawrence@pingtel.com>
Date: Tue, 04 Jan 2005 14:52:02 -0500
To: xmlschema-dev@w3.org
Message-Id: <1104868322.3105.111.camel@sukothai.pingtel.com>
content type xml attachment

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)

-- 
Scott Lawrence
Consulting Engineer
Pingtel Corp.
http://www.pingtel.com/
+1.781.938.5306 x162





Received on Wednesday, 5 January 2005 01:48:34 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
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-2007 All Rights Reserved.