-
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).
-
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.
-
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>
-
flow
Sam Whited, FWIW I think what you name XMLName is often called QName (for qualified name)
-
Zash
Matching on bare/full/host JID seems to have worked well in Prosody
-
Kev
Kinda. Qualified names are within a particular document and use declarations.
-
Kev
At least IIRC.
-
Kev
So you can't talk about qnames generically outside the context of a particular document.
-
flow
Kev, for me QName is simply "element name" + "namespace of the element"
-
Sam Whited
Full name?
-
Sam Whited
yah, qname is a prefixed name like stream:stream according to wikipedia
-
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)
-
flow
If you want or need to prefix the name is more a matter of the XML serialization routine
-
ralphm
So syntactically QName is one of PrefixedName or UnprefixedName. Abstractly, a QName is the namespace + prefix + local name.
-
ivy42
ivy42 ivy42 d