XSF Discussion - 2022-12-25


  1. Neustradamus

    Merry Christmas to all!

  2. Ellenor Malik

    Christmas is fraud (:

  3. moparisthebest

    Ellenor Malik: merry fraud to you then

  4. kurisu

    What does xml:lang affect in practice? Do client even set it to anything other than "en"?

  5. kurisu

    Does xmpp use ns prefixes anywhere aside from that?

  6. lovetox

    yes in stream initiation

  7. lovetox

    otherwise no

  8. mjk

    > Does xmpp use ns prefixes anywhere aside from that? you mean, does it _not_ use namespaces somewhere? :)

  9. singpolyma

    kurisu: yes, anywhere anyone chooses to use prefixes

  10. lovetox

    singpolyma, nobody uses anywhere prefixes

  11. kurisu

    Sorry I meant ns prefixes with attributes

  12. singpolyma

    Prefixes vs not are a syntax choice by the producer

  13. mjk

    everything is qualified by some namespace, and <message xmlns="jabber:client" ...> can be encoded as <jabber:client:message ...>

  14. singpolyma

    Oh, specifically namespaced attributes are more rarely useful. Honestly attributes at all are less useful in general

  15. mjk

    probably

  16. lovetox

    you can theoretically, but practically nobody does it

  17. kurisu

    ><jabber:client:message ...> I don't think that's valid xml...

  18. lovetox

    and nobody tried if that would be compatible with clients

  19. lovetox

    or even servers

  20. kurisu

    singpolyma, but does any XEP in practice require namespaced attributes?

  21. lovetox

    not that i know off

  22. kurisu

    I'm just thinking how to parse XMPP correctly and it seems kinda tricky to me b/c of that. Like, if I have expat handle namespaces, I don't know what prefix the producer set, thus I don't see xml:lang="en" but more like http://www.w3.org/XML/1998/namespace:lang="en", and to represent that in DOM internally I still need a prefix... which I don't know... yikes.

  23. kurisu

    Also, will <features xmlns="http://etherx.jabber.org/streams"/> instead of <stream:features/> break stuff?

  24. mjk

    > ><jabber:client:message ...> > I don't think that's valid xml... yeah, you're probably right, only one colon seems to be allowed by https://www.w3.org/TR/xml-names/#ns-qualnames

  25. mjk

    `<fwoop:message xmlns:fwoop="jabber:client" ...>` then would be something legal in xml and, afaik, in xmpp

  26. qy shudders

  27. singpolyma

    kurisu: when you parse XML the prefixes disappear

  28. mjk

    ^this. they're an artifact of encoding, so to speak

  29. singpolyma

    The prefix "xml:" is special because it's build in to XML and not user declared namespace prefix

  30. kurisu

    Turns out you can't inline xmlns in xpath generally. You have to make a local prefix somewhere, maintaining a list of your local made up prefixes... just bruh

  31. mjk

    there was some relevant discussion on this channel about prefixes on December 03

  32. mjk

    s/some/extensive/

  33. kurisu

    singpolyma, > when you parse XML the prefixes disappear I thought I read somewhere up the chat xmpp servers and clients are likely to break if non standard prefixes are supplied. In my client I want to build a DOM. I thought the way I'd go would be take an existing xml library and build its dom in parts with expat. But xml libraries it seems won't let you set a namespaced attr without giving it a prefix. And I was just cautious about this because of the above paragraph. But if namespaced attrs aren't used in practice, I suppose I can just set the prefix to auto generated foo1 foo2 I guess haha

  34. mjk

    > I suppose I can just set the prefix to auto generated foo1 foo2 I guess haha that would change semantics then, no? in absence of prefix, the parent namespace is assumed, iirc

  35. lovetox

    what code language do you use?

  36. mjk

    and yeah, xpath seems to actually depend on particular prefixes to exist in the document, i.e., it doesn't abstract them o_O

  37. mjk

    and yeah, xpath seems to actually depend on particular prefixes to exist in the document, i.e., it doesn't abstract them away o_O

  38. mjk

    that would make xpath pretty weird

  39. jonas’

    xpath is terrible in that way, though xpath implementations often allow you to pass a prefix<->uri map into them

  40. mjk

    ah, that's nicee

  41. mjk

    ah, that's nicer

  42. singpolyma

    mjk: you make up your own prefixes for xpath. It doesn't use ones that may be in document

  43. singpolyma

    It just makes the syntax a bit nicer

  44. mjk

    oh

  45. mjk

    wikipedia might be wrong there, then: > In the case of an XML document in which the namespace prefix gs has been defined, `//gs:enquiry` will find all the `enquiry` elements in that namespace https://en.wikipedia.org/wiki/Xpath#Node_tests I need to parse the actual spec then

  46. jonas’

    kurisu: you never need to know the prefix in xmpp

  47. jonas’

    kurisu: you need to be able to produce specific prefixes (`stream`) for backward compatibility though

  48. jonas’

    (and as others said, generally avoid using any prefixes except on the stream header and the stream prefix on nonzas)

  49. jonas’

    (and as others said, generally avoid generating any prefixes except on the stream header and the stream prefix on nonzas)

  50. jonas’

    so you can safely use expat in a mode which resolves namespaces for you

  51. Zash

    Is there a mode where Expat doesn't?

  52. singpolyma

    Zash: if there is it's called "broken mode please run screaming"

  53. kurisu

    Will <features xmlns="http://etherx.jabber.org/streams"/> instead of <stream:features/> break stuff?

  54. singpolyma

    kurisu: only if the implementation is brokee

  55. singpolyma

    kurisu: only if the implementation is broken

  56. singpolyma

    Then you file a bug

  57. kurisu

    Well, in practice are most implementation broken that way or not?

  58. Zash

    Try it and find out?

  59. singpolyma

    Only way to be sure :)

  60. singpolyma

    Anything else is a rumour

  61. kurisu

    So does xml:lang factually affect anything in practice in existing implementations

  62. singpolyma

    kurisu: Conversations and forks will select an element with a lang matching what language the app is using if one is present

  63. singpolyma

    For body at least

  64. kurisu

    Ok so if I plan on resending stanzas should I make sure it's xml:lang="en" not xmlns:fizz="http://www.w3.org/XML/1998/namespace" fizz:lang="en"?

  65. jonas’

    kurisu: that is not legal xml

  66. singpolyma

    AFAIK xml: is a special reserved prefix you don't declare it

  67. jonas’

    xml forbids rebinding the xml prefiy

  68. jonas’

    xml forbids rebinding the xml namespace

  69. jonas’

    see https://www.w3.org/TR/REC-xml-names/#xmlReserved for details

  70. jonas’

    but yes, you do not need to declare it, and if you do, the prefix must be xml