468,121 Members | 1,464 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,121 developers. It's quick & easy.

Q: attribute default name space


Hello

What is the correct way to associate the attributes with the tag if the
tag has a name space associated with it and the attribute doesn't have a
name space?

i.e.
<mytag
xmlns:mine="my/default/name/space"
xmlns:theirs="Some/one/elses/name/space" >

<mine:atag mine:attr1="my value" attr1="whatever" theirs:attr1="another">

</mine:atag>
</mytag>
The parser shows that mytag is in "my/default/name/space", and

`mine:attr1' is in "my/default/name/space"
`theirs:attr1' is in "Some/one/elses/name/space".
`attr1' is not in a name space
Is there a "correct" way to interpret this? Which attribute should be
associated with the tag? Obviously (?) not `theirs', but I would think
that most commonly an attribute won't have a name space, whereas a tag
commonly would, so the unspaced attribute would normally "go with" a tag
even though the name space is wrong, but the above appears valid, so how
is this interpreted?

malcolm

Jul 20 '05 #1
2 1392
In article <40******@news.victoria.tc.ca>,
Malcolm Dew-Jones <yf***@vtn1.victoria.tc.ca> wrote:
What is the correct way to associate the attributes with the tag if the
tag has a name space associated with it and the attribute doesn't have a
name space?
Elements are no namespace are interpreted according to the element they
appear on.
<mytag
xmlns:mine="my/default/name/space"
xmlns:theirs="Some/one/elses/name/space" >

<mine:atag mine:attr1="my value" attr1="whatever" theirs:attr1="another">


So in this case you would expect to find the "attr1" attribute described
along with the description of mine:atag.

-- Richard
Jul 20 '05 #2
yf***@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:
The parser shows that mytag is in "my/default/name/space", and

`mine:attr1' is in "my/default/name/space"
`theirs:attr1' is in "Some/one/elses/name/space".
`attr1' is not in a name space
Is there a "correct" way to interpret this?
If by 'interpret' you mean 'associate each attribute with
a namespace (or not, as the case may be)', the correct interpretation
is the one you reproduce. If by 'interpret' you mean something
else, like mapping into some appliction semantics, then that
depends on the definitions of the elements and attributes you
are using.
Which attribute should be
associated with the tag?


All of the attributes should be associated with the element.
All of them occur on the element's start-tag. You don't need
to choose among them.

I hope this helps.

-C. M. Sperberg-McQueen
World Wide Web Consortium / MIT CSAIL
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Gabriel Genellina | last post: by
4 posts views Thread by Lénaïc Huard | last post: by
5 posts views Thread by John Gordon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.