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

A Namespace Proposal

  • From: "Pete Cordell" <petexmldev@codalogic.com>
  • To: <xml-dev@lists.xml.org>
  • Date: Mon, 13 Dec 2010 18:01:18 -0000

A Namespace Proposal
I've been thinking about the various namespace ideas that have appeared on 
the list, in particular Michael Kay's proposal for namespaces, but also 
trying to make sure it works for Amy's automated XML1.0 to XML??? converter 
principle, without requiring heuristics to map things like 
http://www.w3.org/1999/XSL/Transform to org.w3c.www.1999.XSL.Transform.  I 
think this is important because a parser ideally wants to present 
http://www.w3.org/1999/XSL/Transform to higher layers rather than 
org.w3c.www.1999.XSL.Transform in this case.

So here goes:

Namespaces SHOULD use the reversed domain name form, e.g. 
org.example.schema.  For compatibility with XML 1.0, namespaces MAY use the 
URI form via setting up namespace aliases which is discussed later in the 

An element or attribute name has the form:

name = ( (namespace | namespace_alias ) ":" )? local_name

e.g.: org.example.schema:my_name

The namespace used in an element's name becomes the active namespace and is 
applied to all of its children that don't themselves have an explicitly 
specified namespace.  Thus, in:


'bar' is in the org.example.schema namespace and the example is equivalent 


To set no namespace, leave the namespace part of the name empty, but include 
the ':' that separates the namespace from the local name, for example: 

For compatibility with XML 1.0, an attribute name without a namespace or 
namespace_alias is always in the empty namespace, as opposed to the active 
namespace.  Thus for an attribute the name 'foo' is always equivalent to 

To allow compatibility with XML 1.0, and to a lesser degree brevity, 
namespace aliases maybe setup.  This is done using 'magic' PIs that have the 
name 'xml:nsalias' which contain multiple attributes in which the name of 
the attribute specifies an alias name and the value of the attribute 
specifies the namespace name.  These PIs are primarily intended for the 
parser and in general are not presented to the application.


<?xml:nsalias xsl="http://www.w3.org/1999/XSL/Transform" ?>

establishes "xsl" as an alias of "http://www.w3.org/1999/XSL/Transform".

XML alias mappings exist from the point at which they are defined until the 
end of the XML document.  (In other words, there is a single namespace alias 
mapping repository that is not aware of the element nesting.)  Aliases 
SHOULD NOT be reassigned from one namespace to another.

A namespace alias must match XML's NCName production.  To reduce the 
potential for conflicts with explicit namespaces, namespace aliases SHOULD 
NOT contain the '.' character.

Wherever an aliases character sequence matches the prefix of an element or 
attribute name, the namespace of the element or attribute becomes that of 
the namespace associated with the alias.

For example, if the above alias is set up:


is conceptually equivalent to:


although of course the latter is not a valid XML name.

As in the case of specifying the namespace directly (e.g. 
org.example.schema:foo), the namespace associated with the namespace alias 
becomes the active namespace.

A namespace alias may also be used in the interests of brevity, for example 
the following is equivalent to the earlier example:

<?xml:nsalias s="org.example.schema"?>

Any thoughts?

Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using C++ XML
data binding to convert XSD schemas to C++ classes.
Visit http://codalogic.com/lmx/ or http://www.xml2cpp.com
for more info

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.
First Name
Last Name
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.