W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2008

Re: Purpose of <xs:sequence/>

From: Boris Kolpackov <boris@codesynthesis.com>
Date: Thu, 19 Jun 2008 15:37:52 +0200
To: Adam Retter <Adam.Retter@landmarkinfo.co.uk>
Cc: xmlschema-dev@w3.org
Message-ID: <20080619133752.GD22112@karelia>

Hi Adam,

Adam Retter <Adam.Retter@landmarkinfo.co.uk> writes:

> <xs:complexType name="Classifier">
> 	<xs:sequence/>
> 	<xs:attribute name="pid" type="xs:string" use="required"/>
> </xs:complexType>

Having an empty sequence like this is valid and is equivalent to not
having one at all.

If the schema is auto-generated then it is easy to see why there
are empty sequence elements. The tool probably just adds the
sequence element (e.g., in DOM) and then iterates over elements
and adds them under it. In cases where there are no elements
you end up with an empty sequence. Someone may also want to do
this in a manually-created schema to highlight the fact that this
is a complex type with empty content (and not just a mistake).


Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde
Received on Thursday, 19 June 2008 14:03:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:14 UTC