Smack

org.jivesoftware.smackx.packet
Class XHTMLExtension

java.lang.Object
  extended by org.jivesoftware.smackx.packet.XHTMLExtension
All Implemented Interfaces:
PacketExtension

public class XHTMLExtension
extends Object
implements PacketExtension

An XHTML sub-packet, which is used by XMPP clients to exchange formatted text. The XHTML extension is only a subset of XHTML 1.0.

The following link summarizes the requirements of XHTML IM: Valid tags.

Warning: this is an non-standard protocol documented by JEP-71. Because this is a non-standard protocol, it is subject to change.

Author:
Gaston Dombiak

Constructor Summary
XHTMLExtension()
           
 
Method Summary
 void addBody(String body)
          Adds a body to the packet.
 Iterator getBodies()
          Returns an Iterator for the bodies in the packet.
 int getBodiesCount()
          Returns a count of the bodies in the XHTML packet.
 String getElementName()
          Returns the XML element name of the extension sub-packet root element.
 String getNamespace()
          Returns the XML namespace of the extension sub-packet root element.
 String toXML()
          Returns the XML representation of a XHTML extension according the specification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XHTMLExtension

public XHTMLExtension()
Method Detail

getElementName

public String getElementName()
Returns the XML element name of the extension sub-packet root element. Always returns "html"

Specified by:
getElementName in interface PacketExtension
Returns:
the XML element name of the packet extension.

getNamespace

public String getNamespace()
Returns the XML namespace of the extension sub-packet root element. According the specification the namespace is always "http://jabber.org/protocol/xhtml-im"

Specified by:
getNamespace in interface PacketExtension
Returns:
the XML namespace of the packet extension.

toXML

public String toXML()
Returns the XML representation of a XHTML extension according the specification. Usually the XML representation will be inside of a Message XML representation like in the following example:
 <message id="MlIpV-4" to="gato1@gato.home" from="gato3@gato.home/Smack">
     <subject>Any subject you want</subject>
     <body>This message contains something interesting.</body>
     <html xmlns="http://jabber.org/protocol/xhtml-im">
         <body><p style='font-size:large'>This message contains something <em>interesting</em>.</p></body>
     </html>
 </message>
 

Specified by:
toXML in interface PacketExtension
Returns:
the packet extension as XML.

getBodies

public Iterator getBodies()
Returns an Iterator for the bodies in the packet.

Returns:
an Iterator for the bodies in the packet.

addBody

public void addBody(String body)
Adds a body to the packet.

Parameters:
body - the body to add.

getBodiesCount

public int getBodiesCount()
Returns a count of the bodies in the XHTML packet.

Returns:
the number of bodies in the XHTML packet.

Smack

Copyright © 2003-2007 Jive Software.