jdev - 2021-11-13


  1. nephele

    xml namespaces is one reason I don't like using xml much, conceptually having just a second nested element if neccesary would work too, but namespaces have yet another way to represent the same conceptual data in it : /

  2. MattJ

    Namespaces aren't quite the same as just having another element, because they allow you to identify elements and prevent conflicts when people extend

  3. nephele

    They are not exactly the same, no, but conceptually there is not that much difference

  4. Squeaky Latex Folf

    It's nice knowing where some features in a stanza come from

  5. Squeaky Latex Folf

    Do you know how hard it is to get search engines to find what you're looking for?

  6. Squeaky Latex Folf

    Especially if you don't know the name of something

  7. lovetox

    i hate when the data you search is the name of the tag

  8. lovetox

    like in https://xmpp.org/extensions/xep-0108.html

  9. lovetox

    i find that bad design

  10. lovetox

    under the assumption that every element is exendable, this means i have to iter the childs, then compare the found tag name against some kind of allowed list

  11. Zash

    treat it as an enum?

  12. lovetox

    yes but thats actually not what i want in an extendable protocol

  13. lovetox

    someone maybe wants to introduce a new element

  14. lovetox

    long story short, this makes things unnecessary error prone

  15. lovetox

    instead do <activity> <general>relaxing</general> <specific>reading</specific> </activiy>

  16. lovetox

    this way i dont need to iterate through childs, i can just tell, get me that element text

  17. lovetox

    it does not matter what other client stuff into this, it will never alter my way of finding what i need

  18. lovetox

    and its perfectly extendable if someone wants to put some new general activity which is not in the list the XEP defines, i can still take it and present it as an activity

  19. MattJ

    I know what you're saying, but that's also harder, you can't just stick arbitrary text in there to "extend" it

  20. lovetox

    on the other side if i find a new child which is not in my list, i dont even know if the goal was to extend the lists of activitys, or if this is some completely different shit

  21. MattJ

    You wouldn't get an unknown child in the same namespacr

  22. MattJ

    You wouldn't get an unknown child in the same namespace

  23. MattJ

    That's the point

  24. lovetox

    you mean everything in that namespace is an activity

  25. MattJ

    Everything defined as an activity, yes

  26. lovetox

    .....

  27. MattJ

    Extending it would use a new namespace (as shown in examples)

  28. lovetox

    thats not the same thing

  29. lovetox

    <activity> <relaxing/> <notanactivity/> </activity>

  30. MattJ

    That's illegal

  31. Zash

    That would be an error.

  32. lovetox

    i can treat this as an protocol violation?

  33. MattJ

    Yes

  34. lovetox

    ok thats good

  35. lovetox

    that makes things more sane

  36. MattJ

    Just get the first child of <activity> that's in the XEP's namespace, it will always be one of the ones defined in the XEP

  37. MattJ

    If not, it's invalid

  38. MattJ

    Ignore stuff in other namespaces

  39. lovetox

    sadly not MattJ, because there is also a <text> chid

  40. lovetox

    the xep forces you to Iterate

  41. Zash

    Something like `getChildSetNS(Set<Name>, Namespace)` would be nice

  42. MattJ

    Unfortunate

  43. lovetox

    from a implementor view, i want things i want to query a specific thing, not go start searching for something

  44. flow

    lovetox> i find that bad design it is bad design

  45. MattJ

    What's a better design?

  46. lovetox

    i put both into attributes

  47. lovetox

    then you can still extend the <activity> tag with childs in other namespaces if you want

  48. lovetox

    or as i said before, define elements and set the values as data of them

  49. lovetox

    i dont understand why the custom extension which is an example in that xep needs to be a child of a specific activity

  50. lovetox

    like its a custom extension anyway not defined anywhere so what does it matter if its a child of a specific activity or just the <activity> tag

  51. MattJ

    The idea is that it's not an additional activity, but a more specific one of the same type

  52. Zash

    What if you're doing 3 things at once!

  53. MattJ

    So if you understand the specific one, you can use that. If not, you still see the outer one

  54. lovetox

    MattJ, simply move the name of the activity into an attribute would work then

  55. lovetox

    <activity xmlns='http://jabber.org/protocol/activity'> <general name="inactive"> <specific name="sleeping"> <hibernating xmlns='http://www.ursus.info/states'/> </specific> </general> </activity>

  56. lovetox

    i would prefer that probably

  57. lovetox

    <activity xmlns='http://jabber.org/protocol/activity' general="inactive" specific="sleeping"> <hibernating xmlns='http://www.ursus.info/states'/> </activity>