Brandon A Dixon wrote:
>>> Is there a way to generate IDs when sending subscription or presence
>>> packets?
>> IIRC, <presence /> stanzas do not strictly require IDs, only <iq />
>> stanzas MUST have ID. See section 9.1.3 from RFC3290[1]
>>
>> [1] http://xmpp.org/rfcs/rfc3920.html#stanzas
> Subscriptions require it though. So what if it's an iq?

Well, you can get XML schema from RFC3921 Appendix B and see, that "id"
has type='xs:NMTOKEN'.

You can find BNF-like grammar for NMTOKEN at XML spec[2].

NameStartChar ::=       ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] |
[#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] |
[#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] |
[#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]

NameChar      ::=       NameStartChar | "-" | "." | [0-9] | #xB7 |
[#x0300-#x036F] | [#x203F-#x2040]

Nmtoken       ::=       (NameChar)+

[2] http://www.w3.org/TR/REC-xml/#NT-Nmtoken

Moreover, `It is OPTIONAL for the value of the 'id' attribute to be
unique` (RFC 3920). Common practice is to have unique IDs for each
stanza within same stream.

Hope, this is enough to generate some IDs :-)

-- 
WBRBW, Leonid Evdokimov

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to