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

 


Help: OASIS Mailing Lists Help | MarkMail Help

office message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [office] OpenDocument TC coordination call minutes 2007-08-13


Lars Oppermann wrote:
> Hi Kohei,
> 
> Yes this is possible in Relax NG (and XSD). You may want to have a look 
> at Murata et al. (2005) for some of the background if you are interested 
> in how the schema languages compare in expressiveness...
> 
> Here is a little example on how this can be done specifically in Relax 
> NG. Consider the following document should be rendered invalid:

Just a hint: MUCH easier to read and write RNG using the compact syntax.

Here's an example of validation of child elements conditioned on an 
attribute.

start = element doc { foo | bar }

foo = attribute type { "foo" }, element x { text }+
bar = attribute type { "bar" }, element y { text }+

This would be valid:

<doc type="foo">
   <x>...</x>
</doc>

.. this would not be valid:

<doc type="foo">
   <y>...</y>
</doc>

Note: you can't do this with XML Schema, and there are some limitations 
even within RNG (you cannot condition validation on an attribute and 
have interleave patterns within that pattern).

Bruce


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]