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


Help: OASIS Mailing Lists Help | MarkMail Help

relax-ng message

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

Subject: Including a schema more than once without causing errors


1. Problem

One of the problems about RELAX NG is "Double inclusion".  When 
a schema is included more than once, we have compile errors.   This 
is because each named pattern in the doubly included schema 
is doubly defined.


I am interested in this problem again, since the RELAX NG schemas for
OOXML (which are provided as part of the OOXML DIS) do not work for this

2. Walkaround in RNG 1.0

A walkaround is to specify the combine attribute everywhere.


But this walkaround makes it impossible to detect unintended name
collision.  Moreover, it hampers conversion to W3C XML Schema.


Another walkaround (which is suggested by the above mail) is 
to "de-include" schema modules and create a monolithic RNC file.
A minor revision to this walkaround is to generate a sequence 
of include statements for the required modules, store the 
the sequence in a new RNG schema, and get rid of all in-line 
include statements from the existing modules.

3. Future extensions of RELAX NG

Although walkarounds might work, extensions of the RELAX NG 
language are preferable as a long term solution.

One proposal from John Cowan is to allow multiple definitions 
without the combine attribute only when the right-hand side of 
the multiple definitions are identical.


Another is to mimic W3C XML Schema, which tries to avoid this problem
by not reading schemas more than once from the same location.  This
approach is very similar to "#pragma once" of the C and C++ programming


However, this approach does not work quite well when different URIs 
reference to the same schema module.  In fact, this has been 
considered as one of the disadvantages of  "#pragma once".

I would like to suggest something similar to "#include guards".  
It is an old friend of C programmers.  It is implemented by a
combination of #define and #ifndef.  


For example, 


	struct foo {
	    int member;


makes sure that this header file is included only once.  

In the RNC setting, I would like to incorporate something 

guard "http://www.example.com/grandfather";

How do people feel?

MURATA Makoto (FAMILY Given) <EB2M-MRT@asahi-net.or.jp>

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