📄 iq.html
字号:
<HR><A NAME="setChildElement(org.dom4j.Element)"><!-- --></A><H3>setChildElement</H3><PRE>public void <B>setChildElement</B>(org.dom4j.Element childElement)</PRE><DL><DD>Sets the child element of this IQ. IQ packets may have a single child element in an extended namespace. This is a convenience method to avoid manipulating this underlying packet's Element instance directly.<p> A sample use of this method might look like the following: <pre> IQ iq = new IQ("time_1"); iq.setTo("mary@example.com"); iq.setType(IQ.Type.GET); iq.setChildElement(docFactory.createElement("query", "jabber:iq:time"));</pre><p> An IQ child element in extended namespaces is used to extend the features of XMPP. Although any valid XML can be included in a child element in an extended namespace, many common features have been standardized as <a href="http://www.jabber.org/jeps">Jabber Enhancement Proposals</a> (JEPs).<P><DD><DL><DT><B>Parameters:</B><DD><CODE>childElement</CODE> - the child element.</DL></DD></DL><HR><A NAME="setChildElement(java.lang.String, java.lang.String)"><!-- --></A><H3>setChildElement</H3><PRE>public org.dom4j.Element <B>setChildElement</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> namespace)</PRE><DL><DD>Sets the child element of this IQ by constructing a new Element with the given name and namespace. The newly created child element is returned. IQ packets may have a single child element in an extended namespace. This method is a convenience method to avoid manipulating the underlying packet's Element instance directly.<p> In some cases, additional custom sub-elements must be added to an IQ child element (called packet extensions). For example, when adding a data form to an IQ response. See <A HREF="../../../org/xmpp/packet/IQ.html#addExtension(org.xmpp.packet.PacketExtension)"><CODE>addExtension(PacketExtension)</CODE></A>.<p> A sample use of this method might look like the following: <pre> IQ iq = new IQ("time_1"); iq.setTo("mary@example.com"); iq.setType(IQ.Type.GET); iq.setChildElement("query", "jabber:iq:time");</pre><P><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the child element name.<DD><CODE>namespace</CODE> - the child element namespace.<DT><B>Returns:</B><DD>the newly created child element.</DL></DD></DL><HR><A NAME="addExtension(org.xmpp.packet.PacketExtension)"><!-- --></A><H3>addExtension</H3><PRE>public void <B>addExtension</B>(<A HREF="../../../org/xmpp/packet/PacketExtension.html" title="class in org.xmpp.packet">PacketExtension</A> extension)</PRE><DL><DD>Adds the element contained in the PacketExtension to the child element of the IQ packet. IQ packets, unlike the other packet types, have a unique child element that holds the packet extensions. If an extension is added to an IQ packet that does not have a child element then an IllegalStateException will be thrown.<p> It is important that this is the first and last time the element contained in PacketExtension is added to another Packet. Otherwise, a runtime error will be thrown when trying to add the PacketExtension's element to the Packet's element. Future modifications to the PacketExtension will be reflected in this Packet.<p> Note: packet extensions on IQ packets are only for use in specialized situations. In most cases, you should only need to set the child element of the IQ.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../org/xmpp/packet/Packet.html#addExtension(org.xmpp.packet.PacketExtension)">addExtension</A></CODE> in class <CODE><A HREF="../../../org/xmpp/packet/Packet.html" title="class in org.xmpp.packet">Packet</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>extension</CODE> - the PacketExtension whose element will be added to this Packet's element.</DL></DD></DL><HR><A NAME="getExtension(java.lang.String, java.lang.String)"><!-- --></A><H3>getExtension</H3><PRE>public <A HREF="../../../org/xmpp/packet/PacketExtension.html" title="class in org.xmpp.packet">PacketExtension</A> <B>getExtension</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> namespace)</PRE><DL><DD>Returns a <A HREF="../../../org/xmpp/packet/PacketExtension.html" title="class in org.xmpp.packet"><CODE>PacketExtension</CODE></A> on the first element found in this packet's child element for the specified <tt>name</tt> and <tt>namespace</tt> or <tt>null</tt> if none was found. If the IQ packet does not have a child element then <tt>null</tt> will be returned.<p> Note: packet extensions on IQ packets are only for use in specialized situations. In most cases, you should only need to set the child element of the IQ.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../org/xmpp/packet/Packet.html#getExtension(java.lang.String, java.lang.String)">getExtension</A></CODE> in class <CODE><A HREF="../../../org/xmpp/packet/Packet.html" title="class in org.xmpp.packet">Packet</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the child element name.<DD><CODE>namespace</CODE> - the child element namespace.<DT><B>Returns:</B><DD>a PacketExtension on the first element found in this packet for the specified name and namespace or <tt>null</tt> if none was found.</DL></DD></DL><HR><A NAME="deleteExtension(java.lang.String, java.lang.String)"><!-- --></A><H3>deleteExtension</H3><PRE>public boolean <B>deleteExtension</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> name, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> namespace)</PRE><DL><DD>Deletes the first element whose element name and namespace matches the specified element name and namespace in this packet's child element. If the IQ packet does not have a child element then this method does nothing and returns <tt>false</tt>.<p> Notice that this method may remove any child element that matches the specified element name and namespace even if that element was not added to the Packet using a <A HREF="../../../org/xmpp/packet/PacketExtension.html" title="class in org.xmpp.packet"><CODE>PacketExtension</CODE></A>.<p> Note: packet extensions on IQ packets are only for use in specialized situations. In most cases, you should only need to set the child element of the IQ.<P><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../../org/xmpp/packet/Packet.html#deleteExtension(java.lang.String, java.lang.String)">deleteExtension</A></CODE> in class <CODE><A HREF="../../../org/xmpp/packet/Packet.html" title="class in org.xmpp.packet">Packet</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the child element name.<DD><CODE>namespace</CODE> - the child element namespace.<DT><B>Returns:</B><DD>true if a child element was removed.</DL></DD></DL><HR><A NAME="createCopy()"><!-- --></A><H3>createCopy</H3><PRE>public <A HREF="../../../org/xmpp/packet/IQ.html" title="class in org.xmpp.packet">IQ</A> <B>createCopy</B>()</PRE><DL><DD>Returns a deep copy of this IQ.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../org/xmpp/packet/Packet.html#createCopy()">createCopy</A></CODE> in class <CODE><A HREF="../../../org/xmpp/packet/Packet.html" title="class in org.xmpp.packet">Packet</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a deep copy of this IQ.</DL></DD></DL><HR><A NAME="createResultIQ(org.xmpp.packet.IQ)"><!-- --></A><H3>createResultIQ</H3><PRE>public static <A HREF="../../../org/xmpp/packet/IQ.html" title="class in org.xmpp.packet">IQ</A> <B>createResultIQ</B>(<A HREF="../../../org/xmpp/packet/IQ.html" title="class in org.xmpp.packet">IQ</A> iq)</PRE><DL><DD>Convenience method to create a new <A HREF="../../../org/xmpp/packet/IQ.Type.html#result"><CODE>IQ.Type.result</CODE></A> IQ based on a <A HREF="../../../org/xmpp/packet/IQ.Type.html#get"><CODE>IQ.Type.get</CODE></A> or <A HREF="../../../org/xmpp/packet/IQ.Type.html#set"><CODE>IQ.Type.set</CODE></A> IQ. The new packet will be initialized with:<ul> <li>The sender set to the recipient of the originating IQ. <li>The recipient set to the sender of the originating IQ. <li>The type set to <A HREF="../../../org/xmpp/packet/IQ.Type.html#result"><CODE>IQ.Type.result</CODE></A>. <li>The id set to the id of the originating IQ. </ul><P><DD><DL><DT><B>Parameters:</B><DD><CODE>iq</CODE> - the <A HREF="../../../org/xmpp/packet/IQ.Type.html#get"><CODE>IQ.Type.get</CODE></A> or <A HREF="../../../org/xmpp/packet/IQ.Type.html#set"><CODE>IQ.Type.set</CODE></A> IQ packet.<DT><B>Returns:</B><DD>a new <A HREF="../../../org/xmpp/packet/IQ.Type.html#result"><CODE>IQ.Type.result</CODE></A> IQ based on the originating IQ.<DT><B>Throws:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if the IQ packet does not have a type of <A HREF="../../../org/xmpp/packet/IQ.Type.html#get"><CODE>IQ.Type.get</CODE></A> or <A HREF="../../../org/xmpp/packet/IQ.Type.html#set"><CODE>IQ.Type.set</CODE></A>.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Openfire 3.6.0a Javadoc</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../org/xmpp/packet/IQ.Type.html" title="enum in org.xmpp.packet"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?org/xmpp/packet/IQ.html" target="_top"><B>FRAMES</B></A> <A HREF="IQ.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#fields_inherited_from_class_org.xmpp.packet.Packet">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR><i>Copyright © 2003-2008 Jive Software.</i></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -