/** * Returns an XML <tt>String</tt> representation of this <tt>IQ</tt>. * * @return an XML <tt>String</tt> representation of this <tt>IQ</tt> */ @Override public String getChildElementXML() { StringBuilder xml = new StringBuilder(); xml.append('<').append(ELEMENT_NAME); xml.append(" xmlns='").append(NAMESPACE).append('\''); String id = getID(); if (id != null) xml.append(' ').append(ID_ATTR_NAME).append("='").append(id).append('\''); List<Content> contents = getContents(); if (contents.size() == 0) { xml.append(" />"); } else { xml.append('>'); for (Content content : contents) content.toXML(xml); xml.append("</").append(ELEMENT_NAME).append('>'); } return xml.toString(); }