-
Guus
Is this semantically equivalent?
-
Guus
<foo xmlns="mynamespace"><bar/></foo> <x:foo xmlns:x="mynamespace"><bar/></x:foo>
-
Guus
is the 'bar' element in the same namespace?
-
Kev
I believe the answer is "yes", but never trust anyone giving XML answers off the top of their head :)
-
jonasw
Guus, no, it’s not equivalent
-
jonasw
<bar/> is in the default namespace in both examples. but in the second example, the default namespace was rebound by <foo xmlns="…"/>, while in the second example, the default namespace is undefined (i.e. no namespace; unless there is outer content which defines the default namespace)
-
jonasw
Guus, ``` >>> t1 = lxml.etree.fromstring('<foo xmlns="mynamespace"><bar/></foo>') >>> t2 = lxml.etree.fromstring('<x:foo xmlns:x="mynamespace"><bar/></x:foo>') >>> t1[0].tag '{mynamespace}bar' >>> t2[0].tag 'bar' ``` (this is clarks notation, i.e. {namespace}local-name)
-
Guus
Thanks Jonas, Kev
-
Kev
I said not to trust me :)
-
jonasw
also, I meant to say "but in the *first* example", not "but in the second example"
-
Guus
No, but you confirmed my suspicion that I had to check 🙂
-
Guus
jonasw, I assumed as much
-
Guus
I didn't get that clarks notation, btw
-
jonasw
Guus, http://www.jclark.com/xml/xmlns.htm
-
jonasw
it’s a way to write namespaced elements, independently of prefixes. it’s very useful for debugging and even for an internal data representaiton
-
jonasw
it’s sometimes used on the mailing list. the name of the element <foo xmlns="bar"/> would be {bar}foo in clarks notation
-
Kev
{jabber:client}message, etc.
-
jonasw
yupp
-
MattJ
Prosody uses that notation in its simplified xpath thing
-
jonasw
it should be used everywhere :)
-
MattJ
ping
-
Zash
Is it Board Time?
-
MattJ
ralphm, Guus, nyco
-
Guus
I can't make it, sorry
-
Guus
About to be in a car again
-
MattJ
np
-
nyco
Hey, bandwidth issue on mobile
-
nyco
Sorry
-
MattJ
Ok, I think we're skipping this week then :)