Whose attributes are they anyway?

S

Soren Kuula

Hi,

I just can't find namespaces of attributes states clearly enough in the
XML namespace spec.
But .. I hear rumors that attributes, unless qualified otherwise,
default to the namespace of the owner element.
Is that right ?

Like:

<?xml version='1.0'?>

<!-- I would think that the "odor" attribute below should belong to the
"smelly->http://www.stench.com"
name space, as its owner element is in that? The irrelevant:eek:dor
attribute, of course, is in
the irrelevant->http://sweetaroma.org namespace ... right? -->

<smelly:skunk
xmlns:smelly="http://www.stench.com"
xmlns:irrelevant="http://sweetaroma.org"
xmlns="dongfang.dk"
odor="a"
irrelevant:eek:dor="b">

<!-- And I would think that these two elements are semantically
indistinguishable
- - although one is 'lexically' a bit more explicit about the
namespace of its
non-"irrelevant"-NS odor attribute than the other .. right? -->

<smelly:inner odor="1" irrelevant:eek:dor="2"/>
<smelly:inner smelly:eek:dor="1" irrelevant:eek:dor="2"/>

<!-- this would be two attributes w same name in same name space and w
same owner element .. an error, right? -->
<smelly:inner smelly:eek:dor="1" odor="2"/>
</smelly:skunk>

TNX for any reply

Soren (who actually needs to decorate element with attributes in a
different NS, without risk o' clashes)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top