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

> 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 UTC