public class XPP3Reader
extends java.lang.Object
XPP3Reader
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.
Constructor | Description |
---|---|
XPP3Reader() |
|
XPP3Reader(DocumentFactory factory) |
Modifier and Type | Method | Description |
---|---|---|
void |
addHandler(java.lang.String path,
ElementHandler handler) |
Adds the
ElementHandler to be called when the specified
path is encounted. |
protected java.io.Reader |
createReader(java.io.InputStream in) |
Factory method to create a Reader from the given InputStream.
|
protected org.dom4j.io.DispatchHandler |
getDispatchHandler() |
|
DocumentFactory |
getDocumentFactory() |
DOCUMENT ME!
|
org.xmlpull.v1.XmlPullParserFactory |
getXPPFactory() |
|
org.xmlpull.v1.XmlPullParser |
getXPPParser() |
|
protected Document |
parseDocument() |
|
Document |
read(char[] text) |
Reads a Document from the given array of characters
|
Document |
read(java.io.File file) |
Reads a Document from the given
File |
Document |
read(java.io.InputStream in) |
Reads a Document from the given stream
|
Document |
read(java.io.InputStream in,
java.lang.String systemID) |
Reads a Document from the given stream
|
Document |
read(java.io.Reader reader) |
Reads a Document from the given
Reader |
Document |
read(java.io.Reader reader,
java.lang.String systemID) |
Reads a Document from the given
Reader |
Document |
read(java.lang.String systemID) |
Reads a Document from the given URL or filename.
|
Document |
read(java.net.URL url) |
Reads a Document from the given
URL |
void |
removeHandler(java.lang.String path) |
Removes the
ElementHandler from the event based processor,
for the specified path. |
void |
setDefaultHandler(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(DocumentFactory documentFactory) |
This sets the
DocumentFactory used to create new
documents. |
void |
setXPPFactory(org.xmlpull.v1.XmlPullParserFactory xPPfactory) |
public XPP3Reader()
public XPP3Reader(DocumentFactory factory)
public Document read(java.io.File file) throws DocumentException, java.io.IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given File
file
- is the File
to read from.DocumentException
- if an error occurs during parsing.java.io.IOException
- if a URL could not be made for the given Fileorg.xmlpull.v1.XmlPullParserException
- DOCUMENT ME!public Document read(java.net.URL url) throws DocumentException, java.io.IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given URL
url
- URL
to read from.DocumentException
- if an error occurs during parsing.java.io.IOException
- DOCUMENT ME!org.xmlpull.v1.XmlPullParserException
- DOCUMENT ME!public Document read(java.lang.String systemID) throws DocumentException, java.io.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.DocumentException
- if an error occurs during parsing.java.io.IOException
- if a URL could not be made for the given Fileorg.xmlpull.v1.XmlPullParserException
- DOCUMENT ME!public Document read(java.io.InputStream in) throws DocumentException, java.io.IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given stream
in
- InputStream
to read from.DocumentException
- if an error occurs during parsing.java.io.IOException
- DOCUMENT ME!org.xmlpull.v1.XmlPullParserException
- DOCUMENT ME!public Document read(java.io.Reader reader) throws DocumentException, java.io.IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given Reader
reader
- is the reader for the inputDocumentException
- if an error occurs during parsing.java.io.IOException
- DOCUMENT ME!org.xmlpull.v1.XmlPullParserException
- DOCUMENT ME!public Document read(char[] text) throws DocumentException, java.io.IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given array of characters
text
- is the text to parseDocumentException
- if an error occurs during parsing.java.io.IOException
- DOCUMENT ME!org.xmlpull.v1.XmlPullParserException
- DOCUMENT ME!public Document read(java.io.InputStream in, java.lang.String systemID) throws DocumentException, java.io.IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given stream
in
- InputStream
to read from.systemID
- is the URI for the inputDocumentException
- if an error occurs during parsing.java.io.IOException
- DOCUMENT ME!org.xmlpull.v1.XmlPullParserException
- DOCUMENT ME!public Document read(java.io.Reader reader, java.lang.String systemID) throws DocumentException, java.io.IOException, org.xmlpull.v1.XmlPullParserException
Reads a Document from the given Reader
reader
- is the reader for the inputsystemID
- is the URI for the inputDocumentException
- if an error occurs during parsing.java.io.IOException
- DOCUMENT ME!org.xmlpull.v1.XmlPullParserException
- DOCUMENT ME!public org.xmlpull.v1.XmlPullParser getXPPParser() throws org.xmlpull.v1.XmlPullParserException
org.xmlpull.v1.XmlPullParserException
public org.xmlpull.v1.XmlPullParserFactory getXPPFactory() throws org.xmlpull.v1.XmlPullParserException
org.xmlpull.v1.XmlPullParserException
public void setXPPFactory(org.xmlpull.v1.XmlPullParserFactory xPPfactory)
public DocumentFactory getDocumentFactory()
DocumentFactory
used to create document
objectspublic void setDocumentFactory(DocumentFactory documentFactory)
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
documentFactory
- DocumentFactory
used to create DOM4J objectspublic void addHandler(java.lang.String path, 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(java.lang.String path)
ElementHandler
from the event based processor,
for the specified path.path
- is the path to remove the ElementHandler
for.public void setDefaultHandler(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.protected Document parseDocument() throws DocumentException, java.io.IOException, org.xmlpull.v1.XmlPullParserException
DocumentException
java.io.IOException
org.xmlpull.v1.XmlPullParserException
protected org.dom4j.io.DispatchHandler getDispatchHandler()
protected void setDispatchHandler(org.dom4j.io.DispatchHandler dispatchHandler)
protected java.io.Reader createReader(java.io.InputStream in) throws java.io.IOException
in
- DOCUMENT ME!java.io.IOException
- DOCUMENT ME!