On 2/10/21 10:00 PM, Dave Cridland wrote:


On Wed, 10 Feb 2021 at 20:22, Florian Schmaus <f...@geekplace.eu <mailto:f...@geekplace.eu>> wrote:

    Since you asked: Smack relies on the ordering (in case a non-default
    form field type is used), since Smack needs to see the <reported/>
    first
    to assign types to the field while parsing the following <item/>s.


Right, so you're parsing using a SAX-style parser and if <reported/> comes after (or in between) the <item/>s, you'd need to use a two-pass parser, is that correct?

Not SAX but StAX, but not that this is relevant. I guess what is relevant is that I cannot rewind the parser (as, for example, a DOM-based would allow).

Furthermore, I do not strictly need two XML-parser passes: I could collect the information about the fields into a "pseudo-field" data structure and assemble the fields with the information found in <reported> after I finished parsing the data form. Of course, this requires additional code and hence adds complexity.

I honestly did not expect this addition to the XEP to cause so much controversy. It appeared clear (to me) that the XEP intention is that <reported> comes first, and then the <item>s follow.

I understand that some languages may not come with a linked-map-like data structure. However, this appears to be a very commonly used data structure. Hence languages like Java and Python ship it as part of their runtime libraries. It should also be easy to add such a thing to your favorite language (likely it already exists as a library).

Eventually, this is a situation where we cannot avoid that somebody needs to change their code. We need to weigh in the effects of the three options:
  A: clearly state that the order is not guaranteed
  B: clearly state that the order is guaranteed
C: state that it should be sent in order, but recipients must be able to process in any order

- Florian

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Standards mailing list
Info: https://mail.jabber.org/mailman/listinfo/standards
Unsubscribe: standards-unsubscr...@xmpp.org
_______________________________________________

Reply via email to