W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2000

RE: Is <any> really enough for <any><body>?

From: Rick Jelliffe <ricko@gate.sinica.edu.tw>
Date: Sun, 23 Jan 2000 16:26:57 +0800
Message-ID: <005901bf657b$9d4cc4a0$8d066d8c@sinica.edu.tw>
To: <www-xml-schema-comments@w3.org>
> What is the right way to express such simple thing as "any element
> with child X".

There are many simple constraints that XML Schema 1.0 will not allow to be
specified. In particular, you can expect that only very direct relationships
can be specified, where one element specifies its attributes and possible
children.

There are various abstraction mechanisms available, such as namespaces and
type derivation, but these again act on the names and types of attributes
and possible child particles in the content.  They give more sophisticated
and intricate management, but do not fundamentally alter that parent/child
relationships are the thing being modeled.

However, XML Schemas can be extended to support other constraints using the
<annotation><appinfo> element.  The new version of the Schematron Assertion
Language (soon at
http://www.ascc.net/xml/resource/schematron/schematron.html ) will include
details of how it can be embedded into and XML Schema <appinfo> element to
provide the kind of thing you seem to be asking for. B.t.w., the Schematron
fragment is
    <rule context="Y"><assert test="*/X" role="grandchild"
    >An element Y must have  grandchild X</assert></rule>

Rick Jelliffe
Received on Sunday, 23 January 2000 03:31:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:46 GMT