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

Re: A proposal for application level XML 'namespaces'

  • From: "Pete Cordell" <petexmldev@codalogic.com>
  • To: "Michael Kay" <mike@saxonica.com>,<xml-dev@l...>
  • Date: Fri, 30 Sep 2011 09:51:38 +0100

Re:  A proposal for application level XML 'namespaces'
Original Message From: "Michael Kay"

I've separated replies to this message into two e-mails for easier issue 
tracking...

> Element names are either absolute (e.g. <:com.example.myschema:parent>) or 
> "relative" (<child>) or prefixed (<myschema:uncle>). A relative name is 
> expanded using the 'namespace' of its nearest absolute container element; 
> if there is none, it is a no-namespace name. The prefix of a prefixed name 
> must match the trailing component(s) of a containing absolute name, and is 
> expanded to be in the namespace given by that absolute name.
>
> Attribute names are the same except that relative names are always 
> no-namespace names.
>
> Only absolute names are used in APIs; applications cannot tell whether a 
> name was written in full or in abbreviated form.

I wonder whether the prefixed form can be removed in the interests of 
simplicity and just accept that in those corner cases where there's lots of 
interleaved namespaces you have to do it using absolute names.  If necessary 
the vocabulary designers could register their prefix with the registry I 
talked about in my earlier mail.  Thus they could register "myschema" as a 
prefix for "com.example.myschema" and then just use "myschema:parent".

I like the idea of the APIs always reporting the absolute names.  My concern 
with that is that it requires the parser to be re-written.  However, if 
you're using an existing XML parser, I think you could easily pipeline the 
processing of the XML so that relative names are expanded to absolute names 
before being handed to your existing XML parser, e.g.:

<:com.example.myschema:parent>
    <child>12</child>
</:com.example.myschema:parent>

gets pre-processed to:

<:com.example.myschema:parent>
    <:com.example.myschema:child>12</:com.example.myschema:child>
</:com.example.myschema:parent>

My next thought is, do we need the colons in the names?  Can we get away 
with names like "com.example.myschema.parent" and just say that the local 
part is a NDName (No Dot Name!)?  My concern is that the presence of colons 
may cause existing parsers to attempt to handle the names as existing 
namespaces, and that could cause problems.

Removing colons and adopting the same pre-processing means:

<com.example.myschema.parent>
    <child>12</child>
</com.example.myschema.parent>

gets pre-processed to:

<com.example.myschema.parent>
    <com.example.myschema.child>12</com.example.myschema.child>
</com.example.myschema.parent>

which I think looks pretty good!

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]


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.