(or, XML in a nuthouse)
It turns out that the type library can be modified to do exactly as
Bruce suggests (below) without changing schema notations. If the MSTL
schema has no targetNamespace attribute, and it is included rather than
imported into the MODS and MADS schemata, its types and elements will be
in the namespace of the including schema.[1]
I didn't catch this earlier because my reference (XML in a Nutshell 2nd
ed) claims that "the target namespace of the included schema must match
that of the including document" (p. 279). The non-normative XML Schema
Part 0: Primer on the W3C site agrees, "The one important caveat to
using include is that the target namespace of the included components
must be the same as the target namespace of the including schema."[2]
These are a bit confusing as the target namespace property is not
necessarily the same as the targetNamespace attribute.
--Andy
[1] http://www.w3.org/TR/xmlschema-1/#compound-schema
[2] http://www.w3.org/TR/xmlschema-0/#SchemaInMultDocs
>>> [log in to unmask] 01/25/05 3:59 PM >>>
I'm just still not understanding why there is any need for this,
unless
you're trying to workaround technical problems with XML Schema.
I just created three files in RELAX NG:
M-Library.rnc
mods.rnc
mads.rnc
The first has no default namespace; the last two each have their own
default namespaces.
Defined like so:
M-Library.rnc
=======
Title = element title { text }
Name = element name { text }
mods.rnc
=======
default namespace = "http://www.loc.gov/mods"
include "M-Library.rnc"
start = MODS
MODS = element mods { Title, Name }
mads.rnc
=======
default namespace = "http://www.loc.gov/mads"
include "M-Library.rnc"
start = MADS
MADS = element mads { Title, Name }
Now, instance documents created against the two schemas:
<?xml version="1.0" encoding="UTF-8"?>
<mods xmlns="http://www.loc.gov/mods">
<title>Some Title</title>
<name>Jane Doe</name>
</mods>
<?xml version="1.0" encoding="UTF-8"?>
<mads xmlns="http://www.loc.gov/mads">
<title>Some Title</title>
<name>Jane Doe</name>
</mads>
Isn't this how it should be?
Bruce
|