Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Q: attribute default name space

Reply
Thread Tools

Q: attribute default name space

 
 
Malcolm Dew-Jones
Guest
Posts: n/a
 
      05-29-2004

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



 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      05-29-2004
In article <(E-Mail Removed)>,
Malcolm Dew-Jones <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
C. M. Sperberg-McQueen
Guest
Posts: n/a
 
      05-31-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (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
 
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
Why Python style guide (PEP-8) says 4 space indents instead of 8 space??? 8 space indents ever ok?? Christian Seberino Python 21 10-27-2003 04:20 PM
Re: Why Python style guide (PEP-8) says 4 space indents instead of8 space??? 8 space indents ever ok?? Ian Bicking Python 2 10-24-2003 11:15 AM
Re: Why Python style guide (PEP-8) says 4 space indents instead of8 space??? 8 space indents ever ok?? Ian Bicking Python 2 10-23-2003 07:07 AM
Stack space, global space, heap space Shuo Xiang C Programming 10 07-11-2003 07:30 PM
Re: Urgent! how to get object name, method name and attribute name based on the strings? ding feng C++ 2 06-25-2003 01:18 PM



Advertisments