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


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:

<doc>
     <a>
         <x/>
         <y/>
         <z/>
     </a>
     <b>
         <a>
             <x/>
             <y/>
             <z/> <!-- not supported here - validation should fail -->
         </a>
     </b>
</doc>

So, what we want to express is that "a" may not contain "z" if it occurs 
as a child "b". A Relax NG grammar to say so can be written as follows 
(I apologize for the size of the example. I'm no good at Relax NG 
compact syntax):

<grammar>
     <start>
         <element name="doc">
             <ref name="a-in-doc"/>
             <ref name="b"/>
         </element>
     </start>

     <define name="a-in-doc">
         <element name="a">
             <ref name="x"/>
             <ref name="y"/>
             <ref name="z"/>
         </element>
     </define>

     <define name="b">
         <element name="b">
             <ref name="a-in-b"/>
         </element>
     </define>

     <!-- this is the a element with the alternate content model -->
     <define name="a-in-b">
         <element name="a">
             <ref name="x"/>
             <ref name="y"/>
         </element>
     </define>

    <define name="x">
         <element name="x"><empty/></element>
     </define>
     <define name="y">
         <element name="y"><empty/></element>
     </define>
     <define name="z">
         <element name="z"><empty/></element>
     </define>
</grammar>


References:

Murata, M., Lee, D., Mani, M., and Kawaguchi, K. (2005) 'Taxonomy of XML 
schema languages using formal language theory'. In: ACM Trans. Inter. 
Tech. 5, 4 (Nov. 2005), 660-704. DOI= 
http://doi.acm.org/10.1145/1111627.1111631
(alternative link: 
http://www.cobase.cs.ucla.edu/tech-docs/dongwon/mura0619.pdf)

Kohei Yoshida wrote:
> Hi Lars,
> 
> On Tue, 2007-08-14 at 11:57 +0200, Lars Oppermann wrote:
> 
>> There are, as you should be aware of, technical possibilities of 
>> constraining the schema as to disallow certain contents in certain 
>> elements depending on their context. This was not possible when the 
>> schema was still specified in a DTD.
> 
> (Please bear with me if this is a basic question as I'm certainly not an
> XML schema expert.)
> 
> So, do I read from your above statement that, now that we are using
> Relax NG as the schema language, it is now possible to constrain or
> specify different sets of legal child elements of *the same element*
> depending on the context?  (it would be great if it is.)
> 
> If yes, then I think we should work toward making it explicit in the
> spec in some way.  Because in reality, the exact meaning and behavior of
> table cells is unfortunately different between word processor and
> spreadsheet apps, the spec IMHO should reflect this and be explicit
> about this in text.
> 
> Even if it's 'no', then we should still put some note about possibly
> different interpretation of the legality of the child elements of
> <table:table-cell> between different application contexts.
> 
> But I'm certainly open to discussions about this.


-- 
Sun Microsystems                Lars Oppermann <lars.oppermann@sun.com>
Nagelsweg 55                    Software Engineer
20097 Hamburg, Germany          Phone: +49 40 23646 959
http://www.sun.com/             Fax:   +49 40 23646 550
-----------------------------------------------------------------------
Sitz der Gesellschaft: Sun Microsystems GmbH, Sonnenallee 1,
D-85551 Kirchheim-Heimstetten, Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering


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