OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
A proposal for application level XML 'namespaces'

Dear All,

Amazing Amy stirred the XML namespaces hornets' nest recently.  I've been 
thinking about the subject too.  Much of this is based on discussions that 
have passed before.

I've come more around to David's (sorry can't remember which one) approach 
of not using namespaces!  But to accommodate my paranoia about clashes of 
data, I propose making the document level element be defined as a reverse 
domain name, (e.g.: com.example.myschema), but then have child elements just 
have a local name.

Therefore you would have something like:


If you use XML Schema to define your XML you'd do something like:

<xs:schema xmlns:xs="...">
   <xs:element name="com.example.myschema">

To allow for shorter names the W3C would run an IANA like registry of short 
name prefixes, such as xml, html, svg, thus allowing document elements with 
<html.html>, <svg.svg> etc.  All non-registry names would have to have three 
or more parts.

References across namespaces would require the full reverse domain.  For 
example, if your XML uses HTML you'd do:


Similarly for attributes.  For example, if it was felt appropriate to bring 
the XML namespace under this convention (I'm not sure it is), you'd do:

   <child xml.id="foo">12</child>

That's about it for element and attribute names.  That leaves QNames.  As a 
general principle I'd make QNames be reverse domain name also, for example:


To allow for shorter names the XML namespace would have added to it an 
attribute called xml.prefixes.  An xml.prefixes attribute would declare a 
set of {short name}/{full name} pairs, for example: xml.prefixes="ex 
com.example cl com.codalogic".  These mappings would apply to all child 
elements (and their attributes) of the element it is defined in.

Then when an application saw a short name in a QName (such as 'ex') it would 
know to expand it to its full name ('com.example').

To make it easier for an application, the schema (or similar) would define 
where an xml.prefixes attribute is allowed to occur.  For example, you'd 
have to do something like:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
   <xs:element name="com.example.myschema">
        <xs:attribute ref="xml.prefixes"/>

To enable:

<com.example.myschema xml.prefixes="ex com.example">

Use of xml.prefixes would be a convention that XML vocabulary writers were 
encouraged to use where appropriate, but wouldn't be required.  It has no 
impact on the XML parser itself.

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]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS