Modules, start patterns, driver files, trang - sanity check

Sean McGrath <[email protected]> Mon, 23 Feb 2004 13:29:39 +0000
Newsgroups gmane.text.xml.relaxng.general
Message-ID <[email protected]>
All,

I'm soliciting advise on how best to implement Relax modules that are both 
usable "standalone" and usable as modules in larger modules and larger 
standalone schemas.

My first thought was to give each module its own start pattern. So, lets 
say I have modules A and B that I wish to use standalone and also as parts 
of a bigger module AB.

         1) I give each module a start pattern.

         2) When I include a module in a larger module, I override its 
start pattern

Example:

File A.rnc - a standalone schema and a module
         A = element a { text }
         start = A

File B.rnc - a standalone schema and a module
         B = element b { text }
         start = B

File AB.rnc - a standalone schema and a module. It includes two 
sub-modules, A and B
         include "a.rnc" { start = AB }
         include "b.rnc" { start = AB }

         AB = element ab { A , B }
         start = AB

However, trang complains with this approach, when generating XSD's:
         - multiple definitions of "#start" without "combine" attribute

If it is the case that I can only override the start pattern once per 
schema, then I can switch to using driver schemas.
         1) Do not put a start pattern into any module

         2) Create a "driver" schema  that includes the module and provides 
a start pattern


Example:

File A.rnc - a module
         A = element a { text }

File A_driver.rnc - driver file to make schema A work standalone
         include "A.rnc"
         start = A

File B.rnc - a module
         B = element b { text }

File B_driver.rnc - driver file to make schema B work standalone
         include "B.rnc"
         start = B

File AB.rnc - a module that includes two sub-modules, A and B
         include "a.rnc"
         include "b.rnc"

         AB = element ab { A , B }

File AB_driver.rnc - driver file to make schema AB work standalone
         include "AB.rnc"
         start = AB

Am I correct that the start patten can only be overridden once per schema? 
Is the driver approach a good way to go or are there better alternatives?

regards,

Sean McGrath
http://seanmcgrath.blogspot.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.