[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: <xml-dev@lists.xml.org>
- Date: Mon, 3 Oct 2011 10:42:18 +0100
Original Message From: "John Cowan" <cowan@ccil.org>
> Pete Cordell scripsit:
>
>> To allow for shorter names the XML namespace would have added to it an
>> attribute called xml.prefixes.
>
> I'm with you up to here, but from here on down you are just
> reinventing XML namespace declarations incompatibly.
After some thought I've decided to align with John's comment above.
Consequently my 'namespace' proposal becomes:
=================
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:
<com.example.myschema>
<child>12</child>
</com.example.myschema>
If you use XML Schema to define your XML you'd do something like:
<xs:schema xmlns:xs="...">
<xs:element name="com.example.myschema">
...
</xs:schema>
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:
<com.example.myschema>
<html.html>...</html.html>
</com.example.myschema>
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:
<com.example.myschema>
<child xml.id="foo">12</child>
</com.example.myschema>
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:
<myQName>com.example.value1</myQName>
To allow for shorter QNames, XML vocabulary designers may declare that
QNames in the vocabulary without any dots (e.g. "value1") are implicitly
associated with a particular domain (e.g. declare that "value1" is treated
as "com.example.value1").
At the choice of the vocabulary designer, the vocabulary my allow shorter
prefixes by referencing some public short domain name registry similar to
that described for element names above.
And, at the choice of the vocabulary designer, a vocabulary specific short
domain name registry can be used by preceding the name with a dot. (The use
of the leading dot allows both the public and vocabulary specific registries
to be used together.)
As an example of QName usage, imagine that a vocabulary exists for
provisioning operating systems remotely. This is called the "Operating
System Provisioning" protocol. This vocabulary has registered a short
domain prefix with the W3C/IANA registry of "osp", and the document element
looks like:
<osp.osp>...</osp.osp>
The specification could declare that support of Microsoft Windows XP is
built in and uses the QName "xp". Therefore to reference XP the XML
becomes:
<osp.osp>
<os>xp</os>
</osp.osp>
This is not particularly extensible and later Microsoft may wish to register
Windows 8. Microsoft could register the short prefix "ms" with the public
registry, and then use "ms.osp.win8" to refer to Win 8, yielding:
<osp.osp>
<os>ms.osp.win8</os>
</osp.osp>
(Microsoft may want to use its publicly registered short prefix in many
vocabularies without worrying about name clashes, which is the reason they
include "osp" in the QName.)
Or the vocabulary could have its own custom registry in which Microsoft
registers "ms". In that case it would use:
<osp.osp>
<os>.ms.win8</os>
</osp.osp>
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]