[relaxng-user] combining schemas
Eric van der Vlist
vdv at dyomedea.com
Tue Nov 25 19:25:40 ICT 2003
On Tue, 2003-11-25 at 19:02, Bruce D'Arcus wrote:
> OK, we're making progress. NXML mode will now load the schema without
> complaining. However, it will not give me any completion options
> anywhere!
In your schema, the element extension appears in:
ModsType =
attribute version { xsd:string "3.0" }?,
attribute ID { xsd:ID }?,
(titleInfo
| name
| typeOfResource
| genre
| originInfo
| language2
| physicalDescription
| abstract
| tableOfContents
| targetAudience
| note
| subject
| classification
| relatedItem
| identifier
| location
| accessCondition
| (notAllowed
| element extension {
mixed { element0+ }
})
| recordInfo)+
What you want to redefine is in fact the content of the extension
element to allow your biblio-notes element instead of "element0" which
is a wildcard generated by the schema converter you've been using.
If we look at your overall schema!
include "biblio-notes.rnc" { start = ModsSchema }
include "mods.rnc" {
extension = element extension { biblio-notes }*
}
You can't redefine the named pattern "extension" since it doesn't exist
in mods.rnc (BTW, it's strange that the RNG processor hasn't raised an
error here).
You could redefine "element0" but that would still give you a mixed
content model for extension with one or more occurrences of
biblio-notes.
One option is to define an "extension-content" pattern:
============
...
ModsType =
attribute version { xsd:string "3.0" }?,
attribute ID { xsd:ID }?,
(titleInfo
| name
| typeOfResource
| genre
| originInfo
| language2
| physicalDescription
| abstract
| tableOfContents
| targetAudience
| note
| subject
| classification
| relatedItem
| identifier
| location
| accessCondition
| element extension { extension-content } *
| recordInfo)+
extension-content = mixed { element0+ }
...
============
and then your schema becomes:
==============================================
include "biblio-notes.rnc"
include "mods.rnc" {
extension-content = biblio-notes
}
==============================================
Another option with the same mods.rnc and a biblio-notes.rnc where
you've got a start pattern is simply:
==============================================
include "mods.rnc" {
extension-content = external "biblio-notes.rnc"
}
==============================================
Hope that helps.
Eric
--
Did you know it? Python has now a Relax NG (partial) implementation.
http://advogato.org/proj/xvif/
Upcoming XML schema languages tutorials:
- Philadelphia -full day- ( 7/12/2003) http://masl.to/?V28612FC5
- Santa Clara -half day- (15/03/2004) http://masl.to/?J24916E96
------------------------------------------------------------------------
Eric van der Vlist http://xmlfr.org http://dyomedea.com
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------
More information about the relaxng-user
mailing list