title: best way to exchange custom XML elements in XMPP?
body: <p>I have an XMPP application where two clients interact (1) a bot programmed with <a href="http://www.igniterealtime.org/projects/smack/" rel="nofollow">Smack</a> (Scala/Java) and (2) a GUI chat client programmed in <a href="http://code.stanziq.com/strophe/" rel="nofollow">strophe</a> (Javascript).</p>
  
  <p>The app needs to exchange custom XML (e.g., as shown below)</p>
  
  <pre><code>&lt;myPacket&gt;
     &lt;response type='sensorData'&gt;
        &lt;temperature units='Kelvin'&gt;
           234
        &lt;/temperature&gt;
     &lt;/response&gt;
  &lt;/myPacket&gt;
  </code></pre>
  
  <p>What is the best way to exchange data? The following are what I could come up with:</p>
  
  <p>1) Write custom XMPP stanzas</p>
  
  <p>2) Embed my XML in currently defined stanzas (e.g, in message or iq)</p>
  
  <p>3) For smack, <a href="http://www.igniterealtime.org/builds/smack/docs/latest/documentation/properties.html" rel="nofollow">use the <code>Message.get(set)Property</code> to read/write custom data</a>. </p>
  
  <p>No. 3) is ruled out because it requires that both clients understand Java objects and use the same library (Smack).</p>
  
  <p>Kindly point me to any other questions addressing the same issue.</p>
  
  <p>[EDIT:] After doing some research, I found that Dataforms (XEP-0004) is the easiest way to do it, provided your library supports it.                </p>