Q: attribute default name space

Discussion in 'XML' started by Malcolm Dew-Jones, May 29, 2004.

  1. 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
    Malcolm Dew-Jones, May 29, 2004
    #1
    1. Advertising

  2. In article <>,
    Malcolm Dew-Jones <> 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
    Richard Tobin, May 29, 2004
    #2
    1. Advertising

  3. (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
    C. M. Sperberg-McQueen, May 31, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ding feng
    Replies:
    2
    Views:
    2,783
    ding feng
    Jun 25, 2003
  2. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,855
    Bryan Bullard
    Jul 11, 2003
  3. Christian Seberino
    Replies:
    21
    Views:
    1,620
    Stephen Horne
    Oct 27, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    975
    Steve Lamb
    Oct 23, 2003
  5. Ian Bicking
    Replies:
    2
    Views:
    702
    Michael Hudson
    Oct 24, 2003
Loading...

Share This Page