[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Namespaces: Biting The Bullet

  • From: John Cowan <cowan@l...>
  • To: XML Dev <xml-dev@i...>
  • Date: Thu, 04 Jun 1998 15:17:21 -0400

biting the bullet
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@c...
	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@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.