code: @Override
      public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
          StringBuilder buf = new StringBuilder();
          buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append(
              "\">");
          // Loop through all roster entries and append them to the string buffer
          for (Iterator<RemoteRosterEntry> i = getRosterEntries(); i.hasNext();) {
              RemoteRosterEntry remoteRosterEntry = i.next();
              buf.append(remoteRosterEntry.toXML());
          }
          buf.append("</").append(getElementName()).append('>');
          return buf.toString();
      }
docs: Returns the XML representation of a Roster Item Exchange according the specification.
  
  Usually the XML representation will be inside of a Message XML representation like
  in the following example:
  <pre>
  &lt;message id="MlIpV-4" to="gato1@gato.home" from="gato3@gato.home/Smack"&gt;
  &lt;subject&gt;Any subject you want&lt;/subject&gt;
  &lt;body&gt;This message contains roster items.&lt;/body&gt;
  &lt;x xmlns="jabber:x:roster"&gt;
  &lt;item jid="gato1@gato.home"/&gt;
  &lt;item jid="gato2@gato.home"/&gt;
  &lt;/x&gt;
  &lt;/message&gt;
  </pre>