Re: RNC modularisation redux
Sean McGrath <[email protected]> Wed, 03 Nov 2004 08:12:47 +0000
| Newsgroups | gmane.text.xml.relaxng.general |
|---|---|
| Organization | Propylon |
| Message-ID | <[email protected]> |
Robert Leftwich wrote: > I have a similar problem to Sean McGrath as described in > http://relaxng.org/pipermail/relaxng-user/2004-July/000544.html and > also Adrian > Robert in > http://lists.oasis-open.org/archives/relax-ng-comment/200407/msg00005.html > but > there was no follow up to Sean's last email and there was only the one > answer to > Adrian's. Given that it seems to work as required in my (limited) > testing, is > specifying 'combine="choice" for every <define> in the base schemas (as > suggested in > http://lists.oasis-open.org/archives/relax-ng-comment/200407/msg00007.html) > the > best way to go? Robert, An update from my own work in this area. Yes, using combine = "choice" gets over the multiple defines error but, unfortunately trang generates an error producing XSD if any file is included more than once. There appear to be good reasons for this :-) I tweaked the trang souce to warn rather than generate an error just to see what would happen. The result was XSDs that where missing element declarations and other such things. So, I switched tack. I wrote a Python program that "de-includes" includes in the compact syntax generating a single output RNC file. As well as resolving the includes, a couple of other things were necessary: 1. Hoisting the datatype declarations to the top 2. Hoisting the namespace declarations to the top (including any default namespace) 3. Generating an error if multiple default namespace declarations found 4. Comment out any "start" definitions in any included RNCs The result monolithic RNCs work great. I treat them as compiled, freeze dried snapshots of a schema at a point in time. Great for knowing exactly what iteration of each module was used in a schema at any one moment. As a bonus prize, trang generates modularised XSDs - one for each namespace in the monolithic RNC. Sean http://seanmcgrath.blogspot.com