public class XMLParser
extends java.lang.Object
XMLParserListener
for receiving events.Constructor | Description |
---|---|
XMLParser() |
Constructs a default XMLParser ready for HTML/XHTML processing.
|
XMLParser(boolean b,
XMLParserListener listener) |
Constructs a new Parser with the default jvm charset.
|
XMLParser(boolean isHtml,
XMLParserListener listener,
java.nio.charset.Charset charset) |
Construct a XMLParser with the given XMLParserConfig.
|
XMLParser(boolean isHtml,
java.nio.charset.Charset charset) |
Constructs a XMLParser.
|
XMLParser(XMLParserListener listener) |
Constructs a new Parser with HTML parsing set to true and the default jvm charset.
|
XMLParser(XMLParserListener listener,
java.nio.charset.Charset charset) |
Construct an XMLParser with the given XMLParserConfig ready for
HTML/XHTML processing..
|
Modifier and Type | Method | Description |
---|---|---|
XMLParser |
addListener(XMLParserListener pl) |
If no
ParserListener is added, parsing with the parser seems
useless no? |
XMLParser |
append(char character) |
|
XMLParser |
append(char[] bytes) |
|
XMLParser |
append(java.lang.String string) |
Appends the given string to the buffer.
|
int |
bufferSize() |
|
java.lang.String |
bufferToString() |
|
void |
comment() |
Triggered for comments.
|
java.lang.String |
current() |
Returns the current content of the text buffer.
|
char |
currentLastChar() |
|
java.lang.String |
currentTag() |
Get the current tag
|
TagState |
currentTagState() |
Get the state of the current tag
|
java.io.InputStreamReader |
detectEncoding(java.io.InputStream in) |
Detects encoding from a stream.
|
void |
endElement() |
Triggered when a closing tag has been encountered.
|
void |
flush() |
Flushes the currently stored data in the buffer.
|
java.nio.charset.Charset |
getCharset() |
Returns the current used character set.
|
boolean |
isDecodeSpecialChars() |
|
XMLParserMemory |
memory() |
Returns the XMLParserMemory.
|
void |
parse(java.io.InputStream in) |
Parse an InputStream with default encoding set
|
void |
parse(java.io.InputStream in,
boolean detectEncoding) |
Parse an InputStream that optionally detects encoding from the stream
|
void |
parse(java.io.InputStream in,
java.nio.charset.Charset charSet) |
Parses an InputStream using the given encoding
|
void |
parse(java.io.Reader reader) |
Parse an Reader
|
XMLParser |
removeListener(XMLParserListener pl) |
Removes a Listener from the list of listeners.
|
StateController |
selectState() |
The state controller of the parser
|
void |
setDecodeSpecialChars(boolean decodeSpecialChars) |
Determines whether special chars like > will be decoded
|
void |
setMonitor(ParserMonitor monitor) |
|
protected void |
setState(State state) |
Set the current state.
|
void |
startElement() |
Triggered when an opening tag has been encountered.
|
void |
text(java.lang.String bs) |
Triggered when content has been encountered.
|
void |
unknownData() |
Triggered when the UnknownState encountered anything before encountering
a tag.
|
public XMLParser()
public XMLParser(boolean isHtml, java.nio.charset.Charset charset)
isHtml
- false if this parser is not going to parse HTML and
whitespace should be submitted as text too.charset
- charsetpublic XMLParser(XMLParserListener listener, java.nio.charset.Charset charset)
listener
- the listenercharset
- the Charsetpublic XMLParser(boolean isHtml, XMLParserListener listener, java.nio.charset.Charset charset)
isHtml
- false if this parser is not going to parse HTML and
whitespace should be submitted as text too.listener
- the listenercharset
- the Charset to usepublic XMLParser(boolean b, XMLParserListener listener)
b
- true if HTML is being parsedlistener
- the XMLParserListenerpublic XMLParser(XMLParserListener listener)
listener
- the XMLParserListenerpublic XMLParser addListener(XMLParserListener pl)
ParserListener
is added, parsing with the parser seems
useless no?pl
- the XMLParserListener
public XMLParser removeListener(XMLParserListener pl)
pl
- the XMLParserListener
to removepublic void parse(java.io.InputStream in) throws java.io.IOException
in
- the InputStream to parsejava.io.IOException
- if IO went wrongpublic void parse(java.io.InputStream in, boolean detectEncoding) throws java.io.IOException
in
- the InputStream to parsedetectEncoding
- true if encoding should be detected from the streamjava.io.IOException
- if IO went wrongpublic void parse(java.io.InputStream in, java.nio.charset.Charset charSet) throws java.io.IOException
in
- the stream to readcharSet
- to use for the constructed reader.java.io.IOException
- if reading failspublic void parse(java.io.Reader reader) throws java.io.IOException
reader
- the readerjava.io.IOException
- if IO went wrongpublic java.io.InputStreamReader detectEncoding(java.io.InputStream in) throws java.io.IOException, java.io.UnsupportedEncodingException
in
- the streamjava.io.IOException
- if IO went wrongjava.io.UnsupportedEncodingException
- if unsupported encoding was detectedprotected void setState(State state)
state
- the current statepublic XMLParser append(char character)
character
- the character to appendpublic StateController selectState()
StateController
public void unknownData()
public void flush()
public java.lang.String current()
public XMLParserMemory memory()
public void startElement()
public void endElement()
public void text(java.lang.String bs)
bs
- the contentpublic void comment()
public char currentLastChar()
public java.lang.String currentTag()
public TagState currentTagState()
public void setMonitor(ParserMonitor monitor)
monitor
- the monitor to setpublic void setDecodeSpecialChars(boolean decodeSpecialChars)
decodeSpecialChars
- true to decode, false to not decodepublic boolean isDecodeSpecialChars()
public java.lang.String bufferToString()
public XMLParser append(char[] bytes)
bytes
- the byte array to appendpublic int bufferSize()
public XMLParser append(java.lang.String string)
string
- the String to appendpublic java.nio.charset.Charset getCharset()
Copyright © 1998–2018. All rights reserved.