XML: How to require either or both of two child elements, but prevent both missing?

Pavel Benda pavelben at SENDME.CZ
Sun Feb 23 12:07:32 CET 2003


Hi all once more,

if there is a problem of messy schema or complexity of this approach for
developers, it is possible to add "processing" validation layer using
Schematron or XSLT template - simply by adding the Schematron or XSLT code
to xs:appinfo element of schema documentation. The application can parse
schema, read code and execute it and report results of additional
validation to user (or to some process).

To catch such problems by Schematron or XSLT is deadly simple. And more, we
can meet worse problems, where the XML schema is absolutely unusable - for
example, dependence "if element A has value X, then value of element B must
fall between Y and Z". In such case, Schematron and XSLT approach is only
possible. Moreover, it is possible to include all such dependencies into
one Schematron/XSLT code.

Pavel Benda
Czech Collection of Microorganisms
pavelben at sendme.cz




More information about the tdwg-content mailing list