Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > what does xmlns do exactly?

Reply
Thread Tools

what does xmlns do exactly?

 
 
gg9h0st
Guest
Posts: n/a
 
      12-14-2006
i've looked XMLNS definition. and still have a question.

what if i define two defferent 'xmlns' for a namespace?

ex)

<nsa:aelement xmlns:nsa="a">
<nsa:aelement xmlns:nsa="b">
</nsa:aelement>
</nsa:aelement>

is it possible? and those two elements work as totaly different
elements?

 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      12-14-2006
> what if i define two defferent 'xmlns' for a namespace?
> <nsa:aelement xmlns:nsa="a">
> <nsa:aelement xmlns:nsa="b">
> </nsa:aelement>
> </nsa:aelement>


Namespace prefix bindings are scoped. The descendants of the outer
element which reference the nsa: prefix understand it to mean the
namespace "a", EXCEPT where that's overridden by another definition as
you've done here. In this example the inner element and all its
descendants understand nsa: to mean the namespace "b".

Remember, the prefix is just a syntactic shorthand. What really carries
meaning is the combination of the URI the prefix is bound to plus the
localname following the prefix.

WARNING: These are NOT good namespace names. Namespace names should be
absolute URI references, according to the W3C. If you're going to use
something short and sloppy, in an example, you should at least use
"http://a" or something of that sort. (There was a major debate about
this in the W3C, due to a combination of sloppy wording in the first
draft of the namespace spec and some fuzzy thinking about whether there
was any useful way to interpret relative namespaces. The decision was
made to deprecate relative namespace URIs until and unless someone
convinces the W3C that they are both necessary and practical.)


>
> is it possible? and those two elements work as totaly different
> elements?
>



--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      12-14-2006
By the way, the "Namespaces in XML" specification, available from the
W3C's website, does spell out how namespace scoping works.
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      12-14-2006
In article <45819442$1@kcnews01>,
Joseph Kesselman <(E-Mail Removed)> wrote:

>The decision was
>made to deprecate relative namespace URIs until and unless someone
>convinces the W3C that they are both necessary and practical.


Should relative namespace URIs be interpreted relative to xml:base?

(That's a rhetorical question, just in case there was any doubt.)

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
Joseph Kesselman
Guest
Posts: n/a
 
      12-14-2006
Richard Tobin wrote:
> Should relative namespace URIs be interpreted relative to xml:base?


1) They shouldn't be used, period. The W3C has deprecated them. There
are absolutely NO promises about what will happen if you insist on
pointing this gun at your foot and pulling the trigger.

2) Namespace URIs are usually not interpreted in any case. A namespace
name is just that, a *NAME*, expressed in URI form mostly because we
already knew how to manage the value space of URIs so people didn't
accidentally use each others' values. There is absolutely NO promise
about whether a resource is actually available at that location or what
it might be if so. (The W3C's Semantic Web working group has been trying
to reach some sort of consensus on this, but as far as I know they still
haven't announced any conclusions.)

3) "Mu."


>
> (That's a rhetorical question, just in case there was any doubt.)
>
> -- Richard



--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      12-14-2006
In article <4581a292@kcnews01>,
Joseph Kesselman <(E-Mail Removed)> wrote:

>> Should relative namespace URIs be interpreted relative to xml:base?


>1) They shouldn't be used, period. The W3C has deprecated them.


My rhetorical question was meant to suggest a reason for them to
continue to...

>2) Namespace URIs are usually not interpreted in any case.


They're not dereferenced, certainly.

>A namespace
>name is just that, a *NAME*, expressed in URI form


Right, but would that name be combined with the current base URI?
Would this be the root element of an XSLT stylesheet?

<stylesheet xmlns="XSL/Transform" xml:base="http://www.w3.org/1999"
version="1.0">

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
Joseph Kesselman
Guest
Posts: n/a
 
      12-14-2006
Richard Tobin wrote:
>>>Should relative namespace URIs be interpreted relative to xml:base?

>>1) They shouldn't be used, period. The W3C has deprecated them.

> My rhetorical question was meant to suggest a reason for them to
> continue to...


Good enough. I'm still surprised how many people DID try to argue that
the meaning of <thisCouldKillYou:safetyPolicy> should change when they
moved the document from one directory to another

>>2) Namespace URIs are usually not interpreted in any case.

> They're not dereferenced, certainly.


Better phrasing; thanks for the correction.

> Right, but would that name be combined with the current base URI?
> Would this be the root element of an XSLT stylesheet?
> <stylesheet xmlns="XSL/Transform" xml:base="http://www.w3.org/1999"
> version="1.0">


No. Namespace names are just literal strings whose syntax is required to
be that of absolute URI references. Absolutely no URI handling magic is
applied to them.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      12-14-2006
In article <4581d1a3$1@kcnews01>,
Joseph Kesselman <(E-Mail Removed)> wrote:

>> Right, but would that name be combined with the current base URI?
> > Would this be the root element of an XSLT stylesheet?
> > <stylesheet xmlns="XSL/Transform" xml:base="http://www.w3.org/1999"
> > version="1.0">


>No. Namespace names are just literal strings whose syntax is required to
>be that of absolute URI references. Absolutely no URI handling magic is
>applied to them.


They *are*, but I was considering the hypothetical case. Combining
namepace names with base URIs is what at least one company who argued
for relative namespace URIs wanted. In particular, they wanted
relative namespace URIs in different documents to be distinct by
virture of being relative to different URIs.

This was one of the few case where the W3C held a ballot to resolve
the issue; as we all now know the result was to deprecate relative
namespace URIs and declare that future specs would "define no
interpretation".

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
Joseph Kesselman
Guest
Posts: n/a
 
      12-14-2006
Richard Tobin wrote:
> This was one of the few case where the W3C held a ballot to resolve
> the issue


And I think consensus, now that we've all had time to think about it is
that the majority decision was, in fact, the right decision. (Remember,
I was there too. One of the few times I've found myself in a
head-to-head with Tim B-L.)

Bringing up a hypothesis which has already been considered and
discredited without clarifying that status strikes me as more confusing
than helpful. XML Namespaces "is what it is and that's all what it is";
let's not distract folks with excursions into why the alternatives are
broken unless they're specifically interested in that history. If pigs
had wings, they'd be pigeons.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      12-15-2006
In article <4581e3b0$1@kcnews01>,
Joseph Kesselman <(E-Mail Removed)> wrote:

>Bringing up a hypothesis which has already been considered and
>discredited without clarifying that status strikes me as more confusing
>than helpful.


I was just giving an illustration of why it was unlikely that the
W3C would ever consider them practical, in response to your original
comment:

>The decision was
>made to deprecate relative namespace URIs until and unless someone
>convinces the W3C that they are both necessary and practical.


Relative namespace URIs are just a can of worms.

I *did* say it was a rhetorical question!

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What does xmlns:xsi and xmlns:xsd attributes mean? afshar XML 3 05-19-2010 02:16 AM
xmlns:SOAP-ENC, xmlns:xsd required? chris.stromberger@gmail.com XML 0 10-26-2005 02:48 PM
Unrecognized attribute 'xmlns'. john1001 ASP .Net 6 10-15-2005 12:32 PM
Ignoreing xmlns in XML document Maziar Aflatoun ASP .Net 0 08-25-2005 03:39 PM
ASP.NET xmlns=''> was not expected problem pei_world ASP .Net 4 06-15-2004 01:17 PM



Advertisments