[
Lists Home |
Date Index |
Thread Index
]
- From: John Cowan <cowan@locke.ccil.org>
- To: XML Dev <xml-dev@ic.ac.uk>
- Date: Thu, 04 Jun 1998 15:17:21 -0400
In order to satisfy Goal 8 of the XSchema effort, it will be
necessary for XSchemas to have some explicit way of encoding
namespaces. The natural approach will be
<!ELEMENT NAMESPACE EMPTY>
<!ATTLIST NAMESPACE
prefix CDATA #REQUIRED
ns CDATA #REQUIRED
src CDATA #IMPLIED>
Except for casing, there should be no real dispute over that.
Now, the real issue: why is a namespace element required, separate
and distinct from the namespace PI? Fundamentally, because XSchemas
(unlike DTDs) are not structurally part of the document they
describe. Therefore, they may well have their own separate and
distinct namespace PIs.
Here's an example XSchema (using my syntax):
<?xml version="1.0">
<?xml:namespace prefix="XS" ns="http://blather.com/blather"?>
<namespace prefix="TEXT" ns="http://plaintext.com/whatever">
<XS:DOCTYPE root="TEXT:TEXT">
<XS:ELEMENT id="TEXT:TEXT">
<XS:SEQ frequency="zeroOrMore">
<XS:REF name="TEXT:P>
</XS:SEQ>
</XS:ELEMENT>
<XS:ELEMENT id="TEXT:P">
<XS:MIXED/>
</XS:ELEMENT>
</XS:DOCTYPE>
What that says, in essence, is that the element GIs (and implicitly
the attribute names as well) *used* in the XSchema come from the namespace
"http://blather.com/blather", whereas the element names *mentioned*
come from "http://plaintext.com/whatever".
A document instance conforming to this XSchema may then begin:
<?xml:namespace prefix="T" ns="http://plaintext.com/whatever"?>
and then a namespace-aware XSchema-based validator will know that
any elements called "T:P" in the document instance has the
properties of the element called "TEXT:P" in the XSchema, since
the namespace names agree.
In principle, the same effect could be achieved by putting actual
namespace PIs into the XSchema, since a namespace PI, like any
other PI, is passed along to the application (in this case, an
XSchema validator application). However, this is contrary to
the spirit of XSchema, which is to express everything using
element/attribute syntax. Furthermore, the use of actual
namespace PIs would license an XML parser to pass through elements
and attributes tagged with those prefixes, whereas the prefixes
should appear in the XSchema only within attribute values, where
they are hidden from the XML parser.
XSchemas may well need other namespace PIs of their own. For
example, if a DOC element contains other elements to indicate
formatting, these presumably come from some namespace other than
the XSchema namespace. If so, a PI will be in order to declare
that namespace and some prefix for it. If the XSchema is
describing that very namespace ... well, that leads to a mixed-level
cross-reference. Keeping the PI distinct from the element solves
the problem.
--
John Cowan http://www.ccil.org/~cowan cowan@ccil.org
You tollerday donsk? N. You tolkatiff scowegian? Nn.
You spigotty anglease? Nnn. You phonio saxo? Nnnn.
Clear all so! 'Tis a Jute.... (Finnegans Wake 16.5)
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)
|