Q: namespaces

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hrvoje Somun

    #1

    Q: namespaces

    <example xmlns:namespace one="http://www.one.com" xmlns="http://www.one.com">
    <check att1="one" att2="two" />
    <check att1="one" namespaceone:at t1="two" />
    </example>


    in my opinion line
    <check att1="one" namespaceone:at t1="two" />
    is wrong (different namespaces for aributes of one element are not allowed)

    right?


  • Julian F. Reschke

    #2
    Re: namespaces

    "Hrvoje Somun" <hrvoje.somunRE MOVE@zg.tel.hr> schrieb im Newsbeitrag
    news:bm5kh8$cfh $1@sunce.iskon. hr...[color=blue]
    > <example xmlns:namespace one="http://www.one.com"[/color]
    xmlns="http://www.one.com">[color=blue]
    > <check att1="one" att2="two" />
    > <check att1="one" namespaceone:at t1="two" />
    > </example>
    >
    >
    > in my opinion line
    > <check att1="one" namespaceone:at t1="two" />
    > is wrong (different namespaces for aributes of one element are not[/color]
    allowed)[color=blue]
    >
    > right?[/color]

    No.


    Comment

    • Hrvoje Somun

      #3
      Re: namespaces


      "Julian F. Reschke" <reschke@muenst er.de> wrote in message
      news:bm5nlb$j1g d3$1@ID-98527.news.uni-berlin.de...[color=blue]
      > "Hrvoje Somun" <hrvoje.somunRE MOVE@zg.tel.hr> schrieb im Newsbeitrag
      > news:bm5kh8$cfh $1@sunce.iskon. hr...[color=green]
      > > <example xmlns:namespace one="http://www.one.com"[/color]
      > xmlns="http://www.one.com">[color=green]
      > > <check att1="one" att2="two" />
      > > <check att1="one" namespaceone:at t1="two" />
      > > </example>
      > >
      > >
      > > in my opinion line
      > > <check att1="one" namespaceone:at t1="two" />
      > > is wrong (different namespaces for aributes of one element are not[/color]
      > allowed)[color=green]
      > >
      > > right?[/color]
      >
      > No.[/color]
      so you think that this is well formed xml code?
      <check namespaceone:at t1="one" namespacetwo:at t1="two" />

      or is this only truth if one attribute is in default namespace?(firs t
      example)


      Comment

      • Martin Boehm

        #4
        Re: namespaces

        "Hrvoje Somun" <hrvoje.somunRE MOVE@zg.tel.hr> wrote in message
        news:bm5nvh$fas $1@sunce.iskon. hr
        [color=blue]
        > so you think that this is well formed xml code?
        > <check namespaceone:at t1="one" namespacetwo:at t1="two" />
        >
        > or is this only truth if one attribute is in default namespace?(firs t
        > example)[/color]

        It is true in both cases. Element nodes and attribute nodes can be
        independently qualified with any namespace. If you omit a qalification
        the attribute is in the namespace of its element, which is in turn in
        the namespace of its parent.

        Martin


        Comment

        • Martin Honnen

          #5
          Re: namespaces



          Martin Boehm wrote:
          [color=blue]
          > "Hrvoje Somun" <hrvoje.somunRE MOVE@zg.tel.hr> wrote in message
          > news:bm5nvh$fas $1@sunce.iskon. hr
          >
          >[color=green]
          >>so you think that this is well formed xml code?
          >><check namespaceone:at t1="one" namespacetwo:at t1="two" />
          >>
          >>or is this only truth if one attribute is in default namespace?(firs t
          >>example)[/color]
          >
          >
          > It is true in both cases. Element nodes and attribute nodes can be
          > independently qualified with any namespace. If you omit a qalification
          > the attribute is in the namespace of its element, which is in turn in
          > the namespace of its parent.[/color]

          I disagree with that, an attribute node has no namespace unless it has a
          qualified name, it is not in the namespace of its element as you suggest.
          Consider
          http://www.w3.org/TR/REC-xml-names/#defaulting
          which clearly says
          Note that default namespaces do not apply directly to attributes.
          This means if you have
          <gods xmlns="http://www.gods.org/2003/gods" name="Kibo" />
          then the attribute named "name" doesn't have a namespace although its
          element has one.

          --

          Martin Honnen
          http://JavaScript.FAQTs.com/

          Comment

          • Martin Boehm

            #6
            Re: namespaces

            "Martin Honnen" <mahotrash@yaho o.de> wrote in message
            news:3f867ad9$1 @olaf.komtel.ne t
            [color=blue][color=green]
            >> If you omit a qalification the attribute is in the namespace
            >> of its element, which is in turn in the namespace of its parent.[/color]
            >
            > I disagree with that, an attribute node has no namespace unless it
            > has a qualified name, it is not in the namespace of its element as
            > you suggest.[/color]

            You are right.
            But despite the fact that it obviously is as you said, this is not
            logical to me. What is the point in not letting attributes inherit the
            namespace of their parent if not otherwise stated?

            Martin


            Comment

            • Richard Tobin

              #7
              Re: namespaces

              In article <3f868517$0$251 33$9b4e6d93@new sread2.arcor-online.net>,
              Martin Boehm <ng.tomalak@arc or.de> wrote:
              [color=blue]
              >But despite the fact that it obviously is as you said, this is not
              >logical to me. What is the point in not letting attributes inherit the
              >namespace of their parent if not otherwise stated?[/color]

              An unprefixed attribute is in no namespace. But the interpretation of
              an attribute in no namespace is determined by the element it is
              attached to - it "belongs" to that element - so this is more a matter
              of terminology and convention than practical importance.

              -- Richard

              --
              Spam filter: to mail me from a .com/.net site, put my surname in the headers.

              FreeBSD rules!

              Comment

              • Martin Boehm

                #8
                Re: namespaces

                "Richard Tobin" <richard@cogsci .ed.ac.uk> wrote in message
                news:bm65ns$2df r$1@pc-news.cogsci.ed. ac.uk
                [color=blue]
                > An unprefixed attribute is in no namespace. But the interpretation of
                > an attribute in no namespace is determined by the element it is
                > attached to - it "belongs" to that element - so this is more a matter
                > of terminology and convention than practical importance.[/color]

                So in the end it _is_ at least virtually (or interpretedly) in the
                namespace of its parent (even though in a DOM it would not have its own
                namespace-uri property set). So why does it explicitly _not_ inherit the
                namespace, I don't understand the reason for this exception.

                Martin


                Comment

                • Hrvoje Somun

                  #9
                  Re: namespaces

                  well yes i just realised that the example must be wrong because thare are
                  two attributes with same name in same element. so namespaces are not problem
                  here, mistake was in attribute name(corect me if i am wrong)
                  "Hrvoje Somun" <hrvoje.somunRE MOVE@zg.tel.hr> wrote in message
                  news:bm5kh8$cfh $1@sunce.iskon. hr...[color=blue]
                  > <example xmlns:namespace one="http://www.one.com"[/color]
                  xmlns="http://www.one.com">[color=blue]
                  > <check att1="one" att2="two" />
                  > <check att1="one" namespaceone:at t1="two" />
                  > </example>
                  >
                  >
                  > in my opinion line
                  > <check att1="one" namespaceone:at t1="two" />
                  > is wrong (different namespaces for aributes of one element are not[/color]
                  allowed)[color=blue]
                  >
                  > right?
                  >
                  >[/color]


                  Comment

                  • Philippe Poulard

                    #10
                    Re: namespaces

                    Martin Boehm wrote:[color=blue]
                    > "Richard Tobin" <richard@cogsci .ed.ac.uk> wrote in message
                    > news:bm65ns$2df r$1@pc-news.cogsci.ed. ac.uk
                    >
                    >[color=green]
                    >>An unprefixed attribute is in no namespace. But the interpretation of
                    >>an attribute in no namespace is determined by the element it is
                    >>attached to - it "belongs" to that element - so this is more a matter
                    >>of terminology and convention than practical importance.[/color]
                    >
                    >
                    > So in the end it _is_ at least virtually (or interpretedly) in the
                    > namespace of its parent (even though in a DOM it would not have its own
                    > namespace-uri property set). So why does it explicitly _not_ inherit the
                    > namespace, I don't understand the reason for this exception.
                    >
                    > Martin
                    >
                    >[/color]

                    because it would be impossible for an attribute to be namespaceless if
                    it was defined within an unprefixed element bounded to the default namespace

                    <foo xmlns="foo-ns" bar="">
                    if bar inherited the foo-ns namespace, how to write a namespaceless
                    attribute ?
                    <f:foo xmlns:f="foo-ns bar="">
                    this could be done only by forcing user to use a prefix on such elements

                    it is simply a design choice : force user to specify a prefix either on
                    element or on attribute; w3c choose that if one need to bound an
                    attribute to a namespace, it must be done with a prefix

                    note: "namespacel ess" means "in no namespace", don't know if it is
                    correct english ;)
                    --
                    Cordialement,

                    ///
                    (. .)
                    -----ooO--(_)--Ooo-----
                    | Philippe Poulard |
                    -----------------------

                    Comment

                    • Martin Boehm

                      #11
                      Re: namespaces

                      "Hrvoje Somun" <hrvoje.somunRE MOVE@zg.tel.hr> wrote in message
                      news:bm67u7$rvf $1@sunce.iskon. hr
                      [color=blue]
                      > well yes i just realised that the example must be wrong because thare
                      > are two attributes with same name in same element.[/color]

                      No, that is allowed, too. They live in different namespaces. Hence they
                      do not have the same name, only the same local name in their respective
                      namespace.

                      Martin


                      Comment

                      • Martin Boehm

                        #12
                        Re: namespaces

                        "Philippe Poulard" <Philippe.Poula rd@sophia.inria .fr> wrote in message
                        news:bm68v7$eup $1@news-sop.inria.fr

                        [color=blue][color=green]
                        >> [...] So why does it explicitly _not_ inherit the namespace,
                        >> I don't understand the reason for this exception.[/color]
                        >
                        > because it would be impossible for an attribute to be namespaceless if
                        > it was defined within an unprefixed element bounded to the default
                        > namespace
                        >
                        > [...]
                        >
                        > it is simply a design choice : force user to specify a prefix either
                        > on element or on attribute; w3c choose that if one need to bound an
                        > attribute to a namespace, it must be done with a prefix[/color]

                        From my point of view: I define an element, put it into context by
                        giving it a namespace to live in... and then I am able to define
                        atributes virtually "not belonging" to the element but to no-one
                        instead?! What is the point defining out-of-context attributes by
                        default? Or, the other way round - what makes a namespaceless attribute
                        necessary? I mean, if it is interpreted as "belonging to" a qualified
                        element anyway.
                        [color=blue]
                        > note: "namespacel ess" means "in no namespace", don't know if it is
                        > correct english ;)[/color]

                        Should be okay, but I am not a native speaker as well.

                        Martin


                        Comment

                        • Richard Tobin

                          #13
                          Re: namespaces

                          In article <3f869e3a$0$251 32$9b4e6d93@new sread2.arcor-online.net>,
                          Martin Boehm <ng.tomalak@arc or.de> wrote:
                          [color=blue]
                          >So in the end it _is_ at least virtually (or interpretedly) in the
                          >namespace of its parent (even though in a DOM it would not have its own
                          >namespace-uri property set). So why does it explicitly _not_ inherit the
                          >namespace, I don't understand the reason for this exception.[/color]

                          The namespace spec *could* have said that an unprefixed attribute is
                          in the namespace of its element. This would have had an advantage for
                          attributes that can be used both on elements in "their own" namespace
                          and on other elements, such as

                          <rdf:descriptio n about="whatever ">

                          and

                          <something rdf:about="what ever">

                          - both the "about" attributes would have been in the same namespace,
                          and writing XPaths to find them would be simpler.

                          Why wasn't this done? I *think* - and you'd need to ask the original
                          authors for a definitive answer - that they didn't want to imply that
                          the foo attribute on one element in a namespace was the same as the
                          foo attribute on another element. An appendix to the namespaces spec
                          talks of "per-element" namespaces or namespace partitions that
                          unprefixed attributes are in, but this idea was never carried through
                          into APIs and, crucially, XPath.

                          -- Richard
                          --
                          Spam filter: to mail me from a .com/.net site, put my surname in the headers.

                          FreeBSD rules!

                          Comment

                          • Richard Tobin

                            #14
                            Re: Q: namespaces

                            In article <bm5kh8$cfh$1@s unce.iskon.hr>,
                            Hrvoje Somun <hrvoje.somunRE MOVE@zg.tel.hr> wrote:
                            [color=blue]
                            ><example xmlns:namespace one="http://www.one.com" xmlns="http://www.one.com">
                            > <check att1="one" att2="two" />
                            > <check att1="one" namespaceone:at t1="two" />
                            ></example>[/color]
                            [color=blue]
                            >in my opinion line
                            ><check att1="one" namespaceone:at t1="two" />
                            >is wrong (different namespaces for aributes of one element are not allowed)[/color]

                            That's ok, because the attributes have different XML 1.0 names
                            (att1 and namespaceone:at t1), and different XML+Namespaces expanded
                            names ({}att1 and {http://www.one.com}att 1, using a common syntax).

                            However, if you'd had

                            <example xmlns:namespace one="http://www.one.com" xmlns="http://www.one.com"
                            xmlns:namespace two="http://www.one.com">
                            <check namespaceone:at t1="one" namespacetwo:at t1="two" />
                            </example>

                            this would be illegal according to XML+Namespaces, since both attributes
                            have the same expanded name {http://www.one.com}att 1.

                            -- Richard
                            --
                            Spam filter: to mail me from a .com/.net site, put my surname in the headers.

                            FreeBSD rules!

                            Comment

                            • Philippe Poulard

                              #15
                              Re: namespaces

                              Martin Boehm wrote:[color=blue]
                              >
                              > From my point of view: I define an element, put it into context by
                              > giving it a namespace to live in...[/color]

                              That's optionnal; so if it may be optionnal that an element can be
                              namespaceless, then it must be the same for attributes.

                              and then I am able to define[color=blue]
                              > atributes virtually "not belonging" to the element but to no-one
                              > instead?! What is the point defining out-of-context attributes by
                              > default? Or, the other way round - what makes a namespaceless attribute
                              > necessary? I mean, if it is interpreted as "belonging to" a qualified
                              > element anyway.
                              >[/color]

                              Attributes may belong to another namespace than its element, so it also
                              may be namespaceless whereas the element is not.
                              <f:foo xmlns:f="foo-ns" xlink:href="... " f:bar="..." bar="..."/>
                              Anyway, all these attribute "belong" to the same element.
                              --
                              Cordialement,

                              ///
                              (. .)
                              -----ooO--(_)--Ooo-----
                              | Philippe Poulard |
                              -----------------------

                              Comment

                              Working...