|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.DefaultHandler | +--org.dom4j.io.SAXContentHandler | +--com.realtime.xmpp.dom.Xmpp2DomTransformer
XMPP transformer that creates DOMs from XMPP streams using the SAX event model.
To use this transformer, construct an instance using the XMPP stream to the Jabber server. Then register as a transformer listener to receive all incoming packets.
If you just want to send one packet and process the response packet, use the DomPacketSender.
Field Summary | |
static int |
HEAD
Make new listener the first to get packets. |
protected java.util.List |
m_listeners
The packet listeners. |
protected XmppSession |
m_session
The XMPP session we are listening to. |
static int |
TAIL
Make new listener the last to get new packets. |
Constructor Summary | |
Xmpp2DomTransformer(XmppSession session)
Construct a transformer for an XMPP stream. |
Method Summary | |
void |
addListener(DomPacketListener listener)
Add a packet listener to the builder. |
void |
addListener(DomPacketListener listener,
int pos)
Add a packet listener to the builder. |
void |
endDocument()
This event is not propogated to the XMPP interpreter. |
void |
endElement(java.lang.String sUri,
java.lang.String sLocalName,
java.lang.String sQName)
Intercept endElement to kludge localname. |
XmppSession |
getSession()
Provide the XMPP session we are using. |
void |
removeListener(DomPacketListener listener)
Remove a packet listener from the builder. |
void |
startElement(java.lang.String sUri,
java.lang.String sLocalName,
java.lang.String sQName,
org.xml.sax.Attributes attributes)
Intercept startElement to kludge localname. |
Methods inherited from class org.dom4j.io.SAXContentHandler |
addAttributes, addDeclaredNamespaces, addDTDDeclaration, addExternalDTDDeclaration, attributeDecl, characters, comment, completeCurrentTextNode, createDocument, createElementStack, elementDecl, endCDATA, endDTD, endEntity, endPrefixMapping, error, externalEntityDecl, fatalError, getDocument, getElementStack, getEntityResolver, getInputSource, internalEntityDecl, isIgnorableEntity, isIncludeExternalDTDDeclarations, isIncludeInternalDTDDeclarations, isMergeAdjacentText, isStripWhitespaceText, notationDecl, processingInstruction, setElementStack, setEntityResolver, setIncludeExternalDTDDeclarations, setIncludeInternalDTDDeclarations, setInputSource, setMergeAdjacentText, setStripWhitespaceText, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping, unparsedEntityDecl, warning |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
ignorableWhitespace, resolveEntity, setDocumentLocator, skippedEntity |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int HEAD
public static final int TAIL
protected java.util.List m_listeners
protected XmppSession m_session
Constructor Detail |
public Xmpp2DomTransformer(XmppSession session)
Construct a transformer for an XMPP stream. Automatically registers this transformer with the stream.
session
- The XMPP session to the Jabber server.Method Detail |
public XmppSession getSession()
Provide the XMPP session we are using.
* @return XmppSession we are using.
public void startElement(java.lang.String sUri, java.lang.String sLocalName, java.lang.String sQName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
Intercept startElement to kludge localname. This is done to fix the SAXContentHandlers (mis)interpretation of the qualified name.
* @param sUri The URI.
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.dom4j.io.SAXContentHandler
sLocalName
- The element local name.sQName
- The elements qualified name.attributes
- The specified or defaulted attributes.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.public void endElement(java.lang.String sUri, java.lang.String sLocalName, java.lang.String sQName)
Intercept endElement to kludge localname. This is done to fix the SAXContentHandlers (mis)interpretation of the qualified name.
* @param sUri The URI.
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.dom4j.io.SAXContentHandler
sLocalName
- The element local name.sQName
- The elements qualified name.
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.public void addListener(DomPacketListener listener)
Add a packet listener to the builder. Each new XMPP packet will be sent to each registered listener. It is important that each listener NOT modify the packet. The SAME packet object graph is handed to each listener.
This listener will become the last listener on the list. If you want control over the position of the listener, use the addListener( listener, position ) method.
listener
- The DOM packet listener.public void addListener(DomPacketListener listener, int pos)
Add a packet listener to the builder. Each new XMPP packet will be sent to each registered listener. It is important that each listener NOT modify the packet. The SAME packet object graph is handed to each listener.
* @param listener The DOM packet listener.
pos
- The listener position, as defined in this class.public void removeListener(DomPacketListener listener)
Remove a packet listener from the builder.
* @param listener
public void endDocument() throws org.xml.sax.SAXException
This event is not propogated to the XMPP interpreter. Instead, the last element of each XMPP packet causes this event to be fired.
endDocument
in interface org.xml.sax.ContentHandler
endDocument
in class org.dom4j.io.SAXContentHandler
org.xml.sax.SAXException
- Any SAX exception, possibly
wrapping another exception.ContentHandler.endDocument()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |