com.lowagie.text.xml.simpleparser
public final class SimpleXMLParser extends Object
The parser can:
<[CDATA[ ... ]]> construct
\r\n and \r to \n on input, in accordance with the XML Specification, Section 2.11
| Field Summary | |
|---|---|
| static int | ATTRIBUTE_EQUAL |
| static int | ATTRIBUTE_KEY |
| static int | ATTRIBUTE_VALUE |
| String | attributekey the attribute key. |
| HashMap | attributes current attributes |
| String | attributevalue the attribute value. |
| int | character The current character. |
| int | columns the column where the current character occurs |
| SimpleXMLDocHandlerComment | comment The handler to which we are going to forward comments. |
| static int | CDATA |
| static int | COMMENT |
| SimpleXMLDocHandler | doc The handler to which we are going to forward document content |
| StringBuffer | entity current entity (whatever is encountered between & and ;) |
| boolean | eol was the last character equivalent to a newline? |
| static int | ENTITY |
| static int | EXAMIN_TAG |
| boolean | html Are we parsing HTML? |
| static int | IN_CLOSETAG |
| int | lines the line we are currently reading |
| int | nested Keeps track of the number of tags that are open. |
| int | previousCharacter The previous character. |
| static int | PI |
| int | quoteCharacter the quote character that was used to open the quote. |
| static int | QUOTE |
| Stack | stack the state stack |
| int | state the current state |
| static int | SINGLE_TAG |
| String | tag current tagname |
| StringBuffer | text current text (whatever is encountered between tags) |
| static int | TAG_ENCOUNTERED |
| static int | TAG_EXAMINED |
| static int | TEXT |
| static int | UNKNOWN possible states |
| Constructor Summary | |
|---|---|
| SimpleXMLParser(SimpleXMLDocHandler doc, SimpleXMLDocHandlerComment comment, boolean html)
Creates a Simple XML parser object.
| |
| Method Summary | |
|---|---|
| void | doTag() Sets the name of the tag. |
| static String | escapeXML(String s, boolean onlyASCII)
Escapes a string with the appropriated XML codes. |
| void | flush()
Flushes the text that is currently in the buffer.
|
| static String | getDeclaredEncoding(String decl) |
| static String | getEncodingName(byte[] b4)
Returns the IANA encoding name that is auto-detected from
the bytes specified, with the endian-ness of that encoding where appropriate.
(method found in org.apache.xerces.impl.XMLEntityManager, originally published
by the Apache Software Foundation under the Apache Software License; now being
used in iText under the MPL) |
| void | go(Reader r)
Does the actual parsing. |
| void | initTag()
Initialized the tag name and attributes. |
| static void | parse(SimpleXMLDocHandler doc, SimpleXMLDocHandlerComment comment, Reader r, boolean html)
Parses the XML document firing the events to the handler. |
| static void | parse(SimpleXMLDocHandler doc, InputStream in)
Parses the XML document firing the events to the handler. |
| static void | parse(SimpleXMLDocHandler doc, Reader r) |
| void | processTag(boolean start)
processes the tag. |
| int | restoreState()
Gets a state from the stack |
| void | saveState(int s)
Adds a state to the stack. |
| void | throwException(String s) Throws an exception |
Parameters: s the string to be escaped onlyASCII codes above 127 will always be escaped with &#nn; if true
Returns: the escaped string
Parameters: b4 The first four bytes of the input.
Returns: an IANA-encoding string
Parameters: doc the document handler r the document. The encoding is already resolved. The reader is not closed
Throws: IOException on error
Parameters: doc the document handler in the document. The encoding is deduced from the stream. The stream is not closed
Throws: IOException on error
Parameters: start if true we are dealing with a tag that has just been opened; if false we are closing a tag.
Returns: the previous state
Parameters: s a state to add to the stack