OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quick XML Schema question

From: Adam Van Den Hoven <Adam.Hoven@bluezone.net>

>I have a tag in my document that is something like
><mediaclip inpoint="12" outpoint='24' />
>Is there anyway for me to specify the requirement that the inpoint be
>numerically smaller than the out point.

No.  You can only specify individual constraints, that the maximum or
minimum values of each be some sane constant.

For this kind of constraint, you can use the Schematron assertion language.
It can be embedded in XML Schemas <appinfo> annotations, extracted (there is
a free XSLT script xsd2sch  for this) and validated (using one of the
Schematron validators).

To give you an example of what this would look like:
           <sch:rule context="mediaclip">
                 <sch:assert test="@inpoint &lt; @outpoint"
                  >A mediaclip's inpoint should be numerically smaller
                  than the out point. </sch:assert>

If your data has quite a few of these kinds of interrelationships
that you need to check, it is probably worth the effort of using Schematron.
It is very ease to create ad hoc Schematron schemas, and add to them.

(If you only have a couple of constraints, or are not familiar with
XPaths, and don't have any XSLT processors installed, and you have expertise
in DOM already, it would be more straightforward to write your own
little program.)

For some Schematron info, see http://www.ascc.net/xml/schematron

Rick Jelliffe