Q: attribute default name space

M

Malcolm Dew-Jones

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
 
R

Richard Tobin

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
 
C

C. M. Sperberg-McQueen

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
 

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,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top