-
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 : /
-
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
-
nephele
They are not exactly the same, no, but conceptually there is not that much difference
-
Squeaky Latex Folf
It's nice knowing where some features in a stanza come from
-
Squeaky Latex Folf
Do you know how hard it is to get search engines to find what you're looking for?
-
Squeaky Latex Folf
Especially if you don't know the name of something
-
lovetox
i hate when the data you search is the name of the tag
-
lovetox
like in https://xmpp.org/extensions/xep-0108.html
-
lovetox
i find that bad design
-
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
-
Zash
treat it as an enum?
-
lovetox
yes but thats actually not what i want in an extendable protocol
-
lovetox
someone maybe wants to introduce a new element
-
lovetox
long story short, this makes things unnecessary error prone
-
lovetox
instead do <activity> <general>relaxing</general> <specific>reading</specific> </activiy>
-
lovetox
this way i dont need to iterate through childs, i can just tell, get me that element text
-
lovetox
it does not matter what other client stuff into this, it will never alter my way of finding what i need
-
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
-
MattJ
I know what you're saying, but that's also harder, you can't just stick arbitrary text in there to "extend" it
-
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
-
MattJ
You wouldn't get an unknown child in the same namespacr✎ -
MattJ
You wouldn't get an unknown child in the same namespace ✏
-
MattJ
That's the point
-
lovetox
you mean everything in that namespace is an activity
-
MattJ
Everything defined as an activity, yes
-
lovetox
.....
-
MattJ
Extending it would use a new namespace (as shown in examples)
-
lovetox
thats not the same thing
-
lovetox
<activity> <relaxing/> <notanactivity/> </activity>
-
MattJ
That's illegal
-
Zash
That would be an error.
-
lovetox
i can treat this as an protocol violation?
-
MattJ
Yes
-
lovetox
ok thats good
-
lovetox
that makes things more sane
-
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
-
MattJ
If not, it's invalid
-
MattJ
Ignore stuff in other namespaces
-
lovetox
sadly not MattJ, because there is also a <text> chid
-
lovetox
the xep forces you to Iterate
-
Zash
Something like `getChildSetNS(Set<Name>, Namespace)` would be nice
-
MattJ
Unfortunate
-
lovetox
from a implementor view, i want things i want to query a specific thing, not go start searching for something
-
flow
lovetox> i find that bad design it is bad design
-
MattJ
What's a better design?
-
lovetox
i put both into attributes
-
lovetox
then you can still extend the <activity> tag with childs in other namespaces if you want
-
lovetox
or as i said before, define elements and set the values as data of them
-
lovetox
i dont understand why the custom extension which is an example in that xep needs to be a child of a specific activity
-
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
-
MattJ
The idea is that it's not an additional activity, but a more specific one of the same type
-
Zash
What if you're doing 3 things at once!
-
MattJ
So if you understand the specific one, you can use that. If not, you still see the outer one
-
lovetox
MattJ, simply move the name of the activity into an attribute would work then
-
lovetox
<activity xmlns='http://jabber.org/protocol/activity'> <general name="inactive"> <specific name="sleeping"> <hibernating xmlns='http://www.ursus.info/states'/> </specific> </general> </activity>
-
lovetox
i would prefer that probably
-
lovetox
<activity xmlns='http://jabber.org/protocol/activity' general="inactive" specific="sleeping"> <hibernating xmlns='http://www.ursus.info/states'/> </activity>