[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] A proposal for application level XML 'namespaces'
- From: "Pete Cordell" <petexmldev@codalogic.com>
- To: "Michael Kay" <mike@saxonica.com>,<xml-dev@lists.xml.org>
- Date: Fri, 30 Sep 2011 09:51:38 +0100
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]