android: xmpp中如何给body的子元素添加属性

android: how to add attribute to the body ‘s child Element in xmpp

我想像这样在 XMPP 中发送消息:

<message from='86@this' to='861@this' type='chat'>
<body>
 <number id=279
      title='hi'
      word='hello boy'/>
</body>
</message>

修改MessageclasstoXML()方法

if(defaultBody != null){
      buf.append("<body>);
        if(number != null){
           buf.append("<number").append("id=\"").append(id).append("\"").append("/>");
        }
  }

这样补充,希望对你有帮助..谢谢..

RFC 6120/6121 禁止 <body/> 内的元素。将您的数据放入自定义扩展元素中。