XSF Discussion - 2018-06-14


  1. Guus

    Is this semantically equivalent?

  2. Guus

    <foo xmlns="mynamespace"><bar/></foo> <x:foo xmlns:x="mynamespace"><bar/></x:foo>

  3. Guus

    is the 'bar' element in the same namespace?

  4. Kev

    I believe the answer is "yes", but never trust anyone giving XML answers off the top of their head :)

  5. jonasw

    Guus, no, it’s not equivalent

  6. 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)

  7. 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)

  8. Guus

    Thanks Jonas, Kev

  9. Kev

    I said not to trust me :)

  10. jonasw

    also, I meant to say "but in the *first* example", not "but in the second example"

  11. Guus

    No, but you confirmed my suspicion that I had to check 🙂

  12. Guus

    jonasw, I assumed as much

  13. Guus

    I didn't get that clarks notation, btw

  14. jonasw

    Guus, http://www.jclark.com/xml/xmlns.htm

  15. 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

  16. jonasw

    it’s sometimes used on the mailing list. the name of the element <foo xmlns="bar"/> would be {bar}foo in clarks notation

  17. Kev

    {jabber:client}message, etc.

  18. jonasw

    yupp

  19. MattJ

    Prosody uses that notation in its simplified xpath thing

  20. jonasw

    it should be used everywhere :)

  21. MattJ

    ping

  22. Zash

    Is it Board Time?

  23. MattJ

    ralphm, Guus, nyco

  24. Guus

    I can't make it, sorry

  25. Guus

    About to be in a car again

  26. MattJ

    np

  27. nyco

    Hey, bandwidth issue on mobile

  28. nyco

    Sorry

  29. MattJ

    Ok, I think we're skipping this week then :)