W3C home > Mailing lists > Public > xmlschema-dev@w3.org > November 2005

Re: XML Schema

From: <noah_mendelsohn@us.ibm.com>
Date: Wed, 9 Nov 2005 12:20:50 -0500
To: "Udo Ende" <u.ende@mid.de>
Cc: "Xmlschema-Dev-Request" <xmlschema-dev@w3.org>
Message-ID: <OFE3F5167F.52F7A776-ON852570B4.0056B186-852570B4.005F4B26@lotus.com>

I can't offhand think of a way to do this in XML Schema, but I should 
point out that many in the XML community consider the example you describe 
to be a suboptimal use of XML markup.  Very often when you have rules 
like:

Some of the inner elements are only optional, others are included more 
than one time (therefore I can not use "all" for the complexType).

There is some implied structure that the markup is not capturing.  It's 
hard to be sure without seeing some details, but very often adding levels 
of markup in the instance makes the XML more self-describing, and at the 
same time makes it more suitable for Schema validation.   Among the reaons 
that schema does not support more elaborate pattern specifications for 
content models is that they are so often (though admittedly not always) a 
questionnable approach.

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








"Udo Ende" <u.ende@mid.de>
Sent by: xmlschema-dev-request@w3.org
11/08/2005 10:41 AM
 
        To:     "Xmlschema-Dev-Request" <xmlschema-dev@w3.org>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        XML Schema



Hi,

I do not find a solution for my following problem:

The root elements of my XML data contain many different inner elements.
Therefore I chose a complexType definition for the root elements.

Some of the inner elements are only optional, others are included more 
than
one time (therefore I can not use "all" for the complexType).

I can not tell in which order the inner elements will appear. Therefore I
can not use "sequence" for the complexType.

I decided to use "choice" - with the attribute "maxOccurs" "unbounded" not
only allowing one element under the root elements.

But with that it seems I lose a validation opportunity to tell if an inner
element must appear or is only optional (minOccurs 1 for the inner 
elements
does not show a difference within validation).

Any idea how I could handle this situation?

Regards,
Udo
Received on Wednesday, 9 November 2005 17:21:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:51 GMT