|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.itextpdf.tool.xml.parser.XMLParser
public class XMLParser
Reads an XML file. Attach a XMLParserListener for receiving events.
| Constructor Summary | |
|---|---|
XMLParser()
Constructs a default XMLParser ready for HTML/XHTML processing. |
|
XMLParser(boolean isHtml,
Charset charset)
Constructs a XMLParser. |
|
XMLParser(boolean b,
XMLParserListener listener)
Constructs a new Parser with the default jvm charset. |
|
XMLParser(boolean isHtml,
XMLParserListener listener,
Charset charset)
Construct a XMLParser with the given XMLParserConfig. |
|
XMLParser(XMLParserListener listener)
Constructs a new Parser with HTML parsing set to true and the default jvm charset. |
|
XMLParser(XMLParserListener listener,
Charset charset)
Construct an XMLParser with the given XMLParserConfig ready for HTML/XHTML processing.. |
|
| Method Summary | |
|---|---|
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(String string)
Appends the given string to the buffer. |
int |
bufferSize()
|
String |
bufferToString()
|
void |
comment()
Triggered for comments. |
String |
current()
Returns the current content of the text buffer. |
char |
currentLastChar()
|
String |
currentTag()
Get the current tag |
TagState |
currentTagState()
Get the state of the current tag |
InputStreamReader |
detectEncoding(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. |
Charset |
getCharset()
Returns the current used character set. |
XMLParserMemory |
memory()
Returns the XMLParserMemory. |
void |
parse(InputStream in)
Parse an InputStream with default encoding set |
void |
parse(InputStream in,
boolean detectEncoding)
Parse an InputStream that optionally detects encoding from the stream |
void |
parse(InputStream in,
Charset charSet)
Parses an InputStream using the given encoding |
void |
parse(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 |
setMonitor(ParserMonitor monitor)
|
protected void |
setState(State state)
Set the current state. |
void |
startElement()
Triggered when an opening tag has been encountered. |
void |
text(String bs)
Triggered when content has been encountered. |
void |
unknownData()
Triggered when the UnknownState encountered anything before encountering a tag. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XMLParser()
public XMLParser(boolean isHtml,
Charset charset)
isHtml - false if this parser is not going to parse HTML and
whitespace should be submitted as text too.charset - charset
public XMLParser(XMLParserListener listener,
Charset charset)
listener - the listenercharset - the Charset
public XMLParser(boolean isHtml,
XMLParserListener listener,
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 use
public XMLParser(boolean b,
XMLParserListener listener)
b - true if HTML is being parsedlistener - the XMLParserListenerpublic XMLParser(XMLParserListener listener)
listener - the XMLParserListener| Method Detail |
|---|
public 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 remove
public void parse(InputStream in)
throws IOException
in - the InputStream to parse
IOException - if IO went wrong
public void parse(InputStream in,
boolean detectEncoding)
throws IOException
in - the InputStream to parsedetectEncoding - true if encoding should be detected from the stream
IOException - if IO went wrong
public void parse(InputStream in,
Charset charSet)
throws IOException
in - the stream to readcharSet - to use for the constructed reader.
IOException - if reading fails
public void parse(Reader reader)
throws IOException
reader - the reader
IOException - if IO went wrong
public InputStreamReader detectEncoding(InputStream in)
throws IOException,
UnsupportedEncodingException
in - the stream
IOException - if IO went wrong
UnsupportedEncodingException - if unsupported encoding was detectedprotected void setState(State state)
state - the current statepublic XMLParser append(char character)
character - the character to append
public StateController selectState()
StateControllerpublic void unknownData()
public void flush()
public String current()
public XMLParserMemory memory()
public void startElement()
public void endElement()
public void text(String bs)
bs - the contentpublic void comment()
public char currentLastChar()
public String currentTag()
public TagState currentTagState()
public void setMonitor(ParserMonitor monitor)
monitor - the monitor to setpublic String bufferToString()
public XMLParser append(char[] bytes)
bytes - the byte array to append
public int bufferSize()
public XMLParser append(String string)
string - the String to append
public Charset getCharset()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||