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

RE: Purpose of <xs:sequence/>

From: Paul Kiel <paul@xmlhelpline.com>
Date: Thu, 19 Jun 2008 10:16:01 -0400
To: "'Boris Kolpackov'" <boris@codesynthesis.com>, "'Adam Retter'" <Adam.Retter@landmarkinfo.co.uk>
Cc: <xmlschema-dev@w3.org>
Message-ID: <6CA86F1A3BC941F0903CDA63E86EF990@xmlguy>
RE: Purpose of <xs:sequence/>

I've seen this happen a lot.  If a source has a very large data model and/or
schema, they may only want to communicate to a trading partner the data
nodes they need to care about.  Who wants to wade through a sometimes
gigantic schema when you only need to populate a minority of fields?

And so the data model removes unneeded data elements from the schema.  This
leaves empty sequence nodes.

Removing unneeded elements from a schema is a common request I have gotten
from clients.  It has caused me to create a real simple xslt based solution
which I call the "schema lightener".  It is explained here:
http://www.xmlhelpline.com/tools/index.html

FWIW,

Paul Kiel

=====================================================
W. Paul Kiel
xmlHelpline.com Consulting
paul@xmlhelpline.com
work: 919-846-0224
cell: 919-449-8801
website: http://www.xmlhelpline.com
Your helpline for data integration solutions.
=====================================================



-----Original Message-----
From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Boris Kolpackov
Sent: Thursday, June 19, 2008 9:38 AM
To: Adam Retter
Cc: xmlschema-dev@w3.org
Subject: Re: Purpose of <xs:sequence/>


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

-- 
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:17:38 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.