/** * Returns the sub-element XML section of the IQ packet, or the empty String if there * isn't one. * * @return the child element section of the IQ XML. */ public final XmlStringBuilder getChildElementXML() { return getChildElementXML(null); }
@Override public final XmlStringBuilder toXML(String enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace); buf.halfOpenElement(IQ_ELEMENT); addCommonAttributes(buf, enclosingNamespace); if (type == null) { buf.attribute("type", "get"); } else { buf.attribute("type", type.toString()); } buf.rightAngleBracket(); buf.append(getChildElementXML(enclosingNamespace)); buf.closeElement(IQ_ELEMENT); return buf; }
/** * Test creating a simple and empty IQ response. * @throws XmppStringprepException */ @Test public void testGeneratingSimpleResponse() throws XmppStringprepException { final IQ request = new TestIQ(ELEMENT, NAMESPACE); request.setFrom(JidCreate.from("sender@test/Smack")); request.setTo(JidCreate.from("receiver@test/Smack")); final IQ result = IQ.createResultIQ(request); assertEquals(IQ.Type.result, result.getType()); assertNotNull(result.getStanzaId()); assertEquals(request.getStanzaId(), result.getStanzaId()); assertEquals(request.getFrom(), result.getTo()); assertEquals(request.getTo(), result.getFrom()); assertEquals("", result.getChildElementXML().toString()); }
/** * Returns the sub-element XML section of the IQ packet, or the empty String if there * isn't one. * * @return the child element section of the IQ XML. */ public final XmlStringBuilder getChildElementXML() { return getChildElementXML(null); }
public String getChildElementXML() { return request.getChildElementXML(); } };
public String getChildElementXML() { return request.getChildElementXML(); } };
public String getChildElementXML() { return request.getChildElementXML(); } };
String queryXML = getChildElementXML(); if (queryXML != null) { buf.append(queryXML);
public String toXML() { StringBuilder buf = new StringBuilder(); buf.append("<iq "); if (getPacketID() != null) { buf.append("id=\"" + getPacketID() + "\" "); } if (getTo() != null) { buf.append("to=\"").append(StringUtils.escapeForXML(getTo())).append("\" "); } if (getFrom() != null) { buf.append("from=\"").append(StringUtils.escapeForXML(getFrom())).append("\" "); } if (type == null) { buf.append("type=\"get\">"); } else { buf.append("type=\"").append(getType()).append("\">"); } // Add the query section if there is one. String queryXML = getChildElementXML(); if (queryXML != null) { buf.append(queryXML); } // Add the error sub-packet, if there is one. XMPPError error = getError(); if (error != null) { buf.append(error.toXML()); } buf.append("</iq>"); return buf.toString(); }
String queryXML = getChildElementXML(); if (queryXML != null) { buf.append(queryXML);
String queryXML = getChildElementXML(); if (queryXML != null) { buf.append(queryXML);
@Override public final XmlStringBuilder toXML(String enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace); buf.halfOpenElement(IQ_ELEMENT); addCommonAttributes(buf, enclosingNamespace); if (type == null) { buf.attribute("type", "get"); } else { buf.attribute("type", type.toString()); } buf.rightAngleBracket(); buf.append(getChildElementXML(enclosingNamespace)); buf.closeElement(IQ_ELEMENT); return buf; }