jdev - 2020-02-17


  1. Sam Whited

    Thinking about matching handlers to XML elements while parsing as few tokens as possible more I think the way to do it is to match message and presence by type, IQs by type and the XMLName of the payload, and other top level elements by the XML name of the element (with options on all of those for wildcards so you can eg. match all IQs with a payload in a given namespace regardless of the local name).

  2. Sam Whited

    Then I can have specific handlers for each stanza type that get an unmarshaled version of the stanza start element with convenient helper methods (eg. an "IQ" struct with a reply method) and the generic handlers just get the XML token that caused the match and the remainder of the token stream.

  3. Sam Whited

    I feel like I've come to this conclusion before but forgot, I guess we'll see how it does in practice. </rubber-ducking>

  4. flow

    Sam Whited, FWIW I think what you name XMLName is often called QName (for qualified name)

  5. Zash

    Matching on bare/full/host JID seems to have worked well in Prosody

  6. Kev

    Kinda. Qualified names are within a particular document and use declarations.

  7. Kev

    At least IIRC.

  8. Kev

    So you can't talk about qnames generically outside the context of a particular document.

  9. flow

    Kev, for me QName is simply "element name" + "namespace of the element"

  10. Sam Whited

    Full name?

  11. Sam Whited

    yah, qname is a prefixed name like stream:stream according to wikipedia

  12. flow

    I am not sure if the name being prefixed is the property that makes a name qualified. IIRC it is that you have a namespace together with the localpart (unqualified/local name)

  13. flow

    If you want or need to prefix the name is more a matter of the XML serialization routine

  14. ralphm

    So syntactically QName is one of PrefixedName or UnprefixedName. Abstractly, a QName is the namespace + prefix + local name.

  15. ivy42

    ivy42 ivy42 d