Lists Home |
Date Index |
- From: John Cowan <firstname.lastname@example.org>
- To: XML Dev <email@example.com>
- 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>
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:namespace prefix="XS" ns="http://blather.com/blather"?>
<namespace prefix="TEXT" ns="http://plaintext.com/whatever">
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
John Cowan http://www.ccil.org/~cowan firstname.lastname@example.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:email@example.com
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:firstname.lastname@example.org the following message;
To subscribe to the digests, mailto:email@example.com the following message;
List coordinator, Henry Rzepa (mailto:firstname.lastname@example.org)