public class XMPPPacketReader extends Object
XMPPPacketReader is a Reader of DOM4J documents that
uses the fast
XML Pull Parser 3.x.
It is very fast for use in SOAP style environments.
| Modifier and Type | Field and Description |
|---|---|
static Collection<String> |
IGNORED_NAMESPACE_ON_STANZA
Stream of various endpoints (eg: s2s, c2s) use different default namespaces.
|
| Constructor and Description |
|---|
XMPPPacketReader() |
XMPPPacketReader(org.dom4j.DocumentFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHandler(String path,
org.dom4j.ElementHandler handler)
Adds the
ElementHandler to be called when the
specified path is encounted. |
protected Reader |
createReader(InputStream in)
Factory method to create a Reader from the given InputStream.
|
protected org.dom4j.io.DispatchHandler |
getDispatchHandler() |
org.dom4j.DocumentFactory |
getDocumentFactory() |
long |
getLastActive()
Returns the last time a full Document was read or a heartbeat was received.
|
org.xmlpull.v1.XmlPullParserFactory |
getXPPFactory() |
MXParser |
getXPPParser() |
org.dom4j.Document |
parseDocument() |
org.dom4j.Document |
parseDocument(String xml) |
org.dom4j.Document |
read(char[] text)
Reads a Document from the given array of characters
|
org.dom4j.Document |
read(File file)
Reads a Document from the given
File |
org.dom4j.Document |
read(InputStream in)
Reads a Document from the given stream
|
org.dom4j.Document |
read(InputStream in,
String systemID)
Reads a Document from the given stream
|
org.dom4j.Document |
read(Reader reader)
Reads a Document from the given
Reader |
org.dom4j.Document |
read(Reader reader,
String systemID)
Reads a Document from the given
Reader |
org.dom4j.Document |
read(String systemID)
Reads a Document from the given URL or filename.
|
org.dom4j.Document |
read(String charSet,
InputStream in)
Reads a Document from the given stream
|
org.dom4j.Document |
read(URL url)
Reads a Document from the given
URL |
void |
removeHandler(String path)
Removes the
ElementHandler from the event based
processor, for the specified path. |
void |
setDefaultHandler(org.dom4j.ElementHandler handler)
When multiple
ElementHandler instances have been
registered, this will set a default ElementHandler
to be called for any path which does NOT have a handler
registered. |
protected void |
setDispatchHandler(org.dom4j.io.DispatchHandler dispatchHandler) |
void |
setDocumentFactory(org.dom4j.DocumentFactory factory)
This sets the
DocumentFactory used to create new documents. |
void |
setXPPFactory(org.xmlpull.v1.XmlPullParserFactory xppFactory) |
public static final Collection<String> IGNORED_NAMESPACE_ON_STANZA
public XMPPPacketReader()
public XMPPPacketReader(org.dom4j.DocumentFactory factory)
public org.dom4j.Document read(File file) throws org.dom4j.DocumentException, IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given File
file - is the File to read from.org.dom4j.DocumentException - if an error occurs during parsing.MalformedURLException - if a URL could not be made for the given FileIOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic org.dom4j.Document read(URL url) throws org.dom4j.DocumentException, IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given URL
url - URL to read from.org.dom4j.DocumentException - if an error occurs during parsing.IOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic org.dom4j.Document read(String systemID) throws org.dom4j.DocumentException, IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given URL or filename.
If the systemID contains a ':' character then it is
assumed to be a URL otherwise its assumed to be a file name.
If you want finer grained control over this mechansim then please
explicitly pass in either a URL or a File instance
instead of a String to denote the source of the document.
systemID - is a URL for a document or a file name.org.dom4j.DocumentException - if an error occurs during parsing.MalformedURLException - if a URL could not be made for the given FileIOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic org.dom4j.Document read(InputStream in) throws org.dom4j.DocumentException, IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given stream
in - InputStream to read from.org.dom4j.DocumentException - if an error occurs during parsing.IOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic org.dom4j.Document read(String charSet, InputStream in) throws org.dom4j.DocumentException, IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given stream
charSet - the charSet that the input is encoded inin - InputStream to read from.org.dom4j.DocumentException - if an error occurs during parsing.IOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic org.dom4j.Document read(Reader reader) throws org.dom4j.DocumentException, IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given Reader
reader - is the reader for the inputorg.dom4j.DocumentException - if an error occurs during parsing.IOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic org.dom4j.Document read(char[] text)
throws org.dom4j.DocumentException,
IOException,
org.xmlpull.v1.XmlPullParserException
Reads a Document from the given array of characters
text - is the text to parseorg.dom4j.DocumentException - if an error occurs during parsing.IOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic org.dom4j.Document read(InputStream in, String systemID) throws org.dom4j.DocumentException, IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given stream
in - InputStream to read from.systemID - is the URI for the inputorg.dom4j.DocumentException - if an error occurs during parsing.IOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic org.dom4j.Document read(Reader reader, String systemID) throws org.dom4j.DocumentException, IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given Reader
reader - is the reader for the inputsystemID - is the URI for the inputorg.dom4j.DocumentException - if an error occurs during parsing.IOExceptionorg.xmlpull.v1.XmlPullParserExceptionpublic MXParser getXPPParser() throws org.xmlpull.v1.XmlPullParserException
org.xmlpull.v1.XmlPullParserExceptionpublic org.xmlpull.v1.XmlPullParserFactory getXPPFactory()
throws org.xmlpull.v1.XmlPullParserException
org.xmlpull.v1.XmlPullParserExceptionpublic void setXPPFactory(org.xmlpull.v1.XmlPullParserFactory xppFactory)
public org.dom4j.DocumentFactory getDocumentFactory()
DocumentFactory used to create document objectspublic void setDocumentFactory(org.dom4j.DocumentFactory factory)
This sets the DocumentFactory used to create new documents.
This method allows the building of custom DOM4J tree objects to be implemented
easily using a custom derivation of DocumentFactory
factory - DocumentFactory used to create DOM4J objectspublic void addHandler(String path, org.dom4j.ElementHandler handler)
ElementHandler to be called when the
specified path is encounted.path - is the path to be handledhandler - is the ElementHandler to be called
by the event based processor.public void removeHandler(String path)
ElementHandler from the event based
processor, for the specified path.path - is the path to remove the ElementHandler for.public void setDefaultHandler(org.dom4j.ElementHandler handler)
ElementHandler instances have been
registered, this will set a default ElementHandler
to be called for any path which does NOT have a handler
registered.handler - is the ElementHandler to be called
by the event based processor.public long getLastActive()
public org.dom4j.Document parseDocument(String xml) throws org.dom4j.DocumentException
org.dom4j.DocumentExceptionpublic org.dom4j.Document parseDocument()
throws org.dom4j.DocumentException,
IOException,
org.xmlpull.v1.XmlPullParserException
org.dom4j.DocumentExceptionIOExceptionorg.xmlpull.v1.XmlPullParserExceptionprotected org.dom4j.io.DispatchHandler getDispatchHandler()
protected void setDispatchHandler(org.dom4j.io.DispatchHandler dispatchHandler)
protected Reader createReader(InputStream in) throws IOException
IOExceptionCopyright © 2003–2019 Ignite Realtime. All rights reserved.