title: How to get custom attribute value from an XMPP XML message?
body: <p>Ok guys, simple question but pretty important to me.</p>
  
  <p>so, other android client are sending this xml msg:</p>
  
  <pre><code>&lt;message
    id='6ymdM-19'
    to='xox@xox.xox/smack'
    type='chat'&gt;
    &lt;subject&gt;normal&lt;/subject&gt;
    &lt;received xmlns='urn:xmpp:receipts' id='HVgQw-5'/&gt;
  &lt;/message&gt;
  </code></pre>
  
  <p>and my listener is roughly like this:</p>
  
  <pre><code>private class MsgListener implements ChatStateListener {
  /**
   * Constructor.
   */
  public MsgListener() {
  }
  
  @Override
  public void processMessage(Chat chat, org.jivesoftware.smack.packet.Message message) {
      String xmlMessage = message.toXML();
      Log.v(TAG, "XML Chat: "+xmlMessage);
      // getExtension namespace try urn:xmpp:receipts
      if(xmlMessage.contains("&lt;request xmlns=")) {
          Log.d(TAG, "new chat message arrive! reply with RECEIVED!");
          replyReceived(message);
      } else if(xmlMessage.contains("&lt;received xmlns=")) {
          Log.d(TAG, "RECEIVED notification arrived!");
          PacketExtension statusExtension = 
                  message.getExtension("urn:xmpp:receipts");
          Log.d(TAG, "Extension name: "+statusExtension.getElementName());
          Log.d(TAG, "Extension XML: "+statusExtension.toXML());
          Log.d(TAG, "Extension string: "+statusExtension.toString());
      }
  
       ....
       ....
       ....
  } 
  </code></pre>
  
  <p>in this case I want to get the value of attribute "id", inside the "received" element tag.
  but what I got on my Log is like this:</p>
  
  <pre><code>RECEIVED notification arrived!
  D/ChatAdapter(320): Extension name: received
  D/ChatAdapter(320): Extension XML: &lt;received xmlns="urn:xmpp:receipts"&gt;&lt;/received&gt;
  D/ChatAdapter(320): Extension string:              
  org.jivesoftware.smack.packet.DefaultPacketExtension@44f10430
  </code></pre>
  
  <p>So how I can get the 'HVgQw-5' ??</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Actually there's something weird...
  I have receive the xml accordinh from my SMACK debug like this:</p>
  
  <pre><code> &lt;
   D/SMACK(320): 05:40:28 PM RCV  (1156991856): message id="6ymdM-19"  
   to="syeikh@emass.sangkuriang.co.id/Smack" from="emu22@emass.sangkuriang.co.id/Smack"  
   type="chat"&gt;&lt;subject&gt;
   D/SMACK(320): 05:40:28 PM RCV  (1156991856): normal&lt;/subject&gt;&lt;thread&gt;cr0900&lt;/thread&gt;
   **&lt;received xmlns="urn:xmpp:receipts" id="HVgQw-5"/&gt;**&lt;active      
   xmlns="http://jabber.org/protoc
   D/SMACK(320): 05:40:28 PM RCV  (1156991856): ol/chatstates"/&gt;&lt;/message&gt;
  </code></pre>
  
  <p>But when I execute message.toXML it's just print out like this:</p>
  
  <pre><code>XML Chat: &lt;message id="6ymdM-19" to="syeikh@emass.sangkuriang.co.id/Smack" from="emu22@emass.sangkuriang.co.id/Smack" type="chat"&gt;&lt;subject&gt;normal&lt;/subject&gt;&lt;thread&gt;cr0900&lt;/thread&gt;**&lt;received xmlns="urn:xmpp:receipts"&gt;**&lt;/received&gt;&lt;active xmlns="http://jabber.org/protocol/chatstates" /&gt;&lt;/message&gt;
  </code></pre>
  
  <p>Why this is happening? why do I miss the "id" ?</p>