public class HTMLParser extends SGMLParser
HTMLParser parses the HTML 3.2 document
(<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">)
and delivers the sgml events to the listeners
(SGMLParserListeners).
For example:
Reader reader = new BufferedReader(new InputStreamReader(System.in));
HTMLParser parser = new HTMLParser();
parser.addSGMLParserListener(new SGMLParserListener(){});
try {
parser.parse(reader);
}
catch (IOException e) {}
SGMLParserListener,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected static DTD |
HTML_DTD
HTML 3.2 dtd.
|
cdata, contentModelType, CR, dtd, element, elementStack, EOF, exclusions, inclusions, lastChar, LF, listeners, reader, readerStack| コンストラクタと説明 |
|---|
HTMLParser()
Constructs a html parser with HTML 3.2 dtd.
|
HTMLParser(DTD dtd)
Constructs a html parser with the specified dtd.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected static java.lang.String[] |
append(java.lang.String[] s1,
java.lang.String s2) |
protected static java.lang.String[] |
append(java.lang.String[] s1,
java.lang.String[] s2) |
protected static java.lang.String[] |
append(java.lang.String s1,
java.lang.String[] s2) |
protected SGMLEvent |
createCdataEvent(java.lang.String cdata)
Creates an event object for the cdata parsed.
|
protected SGMLEvent |
createCdataEvent(java.lang.String cdata,
boolean nbsp)
Creates an event object for the cdata parsed.
|
protected SGMLEvent |
createEndTagEvent(Element elem)
Creates an event object for the end tag parsed.
|
protected SGMLEvent |
createFinishedEvent()
Creates an event object for the parsing finished.
|
protected static DTD |
createHTMLDTD()
Creates the HTML 3.2 dtd.
|
protected SGMLEvent |
createStartTagEvent(Element elem,
java.util.Hashtable attrs)
Creates an event object for the start tag parsed.
|
protected void |
ero()
Perfroms the action for the entity reference open.
|
protected void |
etago()
Perfroms the action for the end tag open.
|
static DTD |
getHtmlDTD()
Returns the HTML 3.2 dtd.
|
static void |
main(java.lang.String[] args)
Converts the HTML document into the ESIS format.
|
protected void |
parseElementAttributes(Element elem,
java.util.Hashtable attributes)
Parses the attributes with the specified (parsed) element and appends
the parsed results to the specified attributes.
|
protected static void |
setHTMLElements(DTD dtd)
Sets the elements to the HTML 3.2 dtd.
|
protected static void |
setHTMLEntities(DTD dtd)
Sets the entities to the HTML 3.2 dtd.
|
protected void |
stago()
Perfroms the action for the start tag open.
|
protected void |
writeCdataAtEnd(boolean atEndTag)
Flushs the buffer for the cdata and delivers the cdata parsed events.
|
acceptElement, acceptElementInStack, addSGMLParserListener, atEnd, cdataParsed, checkNewElementAcceptable, cro, endParse, endTagCloseAction, endTagParsed, fatalError, isFirstTokenish, isTokenish, isWhitespace, mdo, parse, parseCdata, parseEmpty, parseEndTag, parseError, parseRcdata, parseStartTag, parsingFinished, peekChar, peekEtago, peekRe, peekRefc, peekTagc, peekTago, pio, popElement, popReader, pushElement, pushReader, re, readAction, readActionForCdata, readActionForRcdata, readAttributeAssignToken, readAttributeValueToken, readCdata, readChar, readSGMLToken, readToTagc, removeSGMLParserListener, resetCdata, skipAndReadSGMLToken, skipComment, skipSeparators, skipSeparatorsAndComments, skipToTagc, startParse, startTagParsed, trimLastRe, upTo, upToSeparators, writeCro, writeEro, writeEtago, writeMdo, writePio, writeRe, writeRefc, writeStago, writeTagcprotected static DTD HTML_DTD
public HTMLParser()
public HTMLParser(DTD dtd)
dtd - the specified dtd.public static DTD getHtmlDTD()
protected void parseElementAttributes(Element elem, java.util.Hashtable attributes) throws java.io.IOException
parseElementAttributes クラス内 SGMLParserjava.io.IOExceptionprotected void ero()
throws java.io.IOException
ero クラス内 SGMLParserjava.io.IOExceptionprotected void etago()
throws java.io.IOException
etago クラス内 SGMLParserjava.io.IOExceptionprotected void stago()
throws java.io.IOException
stago クラス内 SGMLParserjava.io.IOExceptionprotected void writeCdataAtEnd(boolean atEndTag)
throws java.io.IOException
writeCdataAtEnd クラス内 SGMLParserjava.io.IOExceptionprotected SGMLEvent createStartTagEvent(Element elem, java.util.Hashtable attrs)
createStartTagEvent クラス内 SGMLParserprotected SGMLEvent createEndTagEvent(Element elem)
createEndTagEvent クラス内 SGMLParserprotected SGMLEvent createCdataEvent(java.lang.String cdata)
createCdataEvent クラス内 SGMLParserprotected SGMLEvent createCdataEvent(java.lang.String cdata, boolean nbsp)
protected SGMLEvent createFinishedEvent()
createFinishedEvent クラス内 SGMLParserprotected static DTD createHTMLDTD()
protected static void setHTMLElements(DTD dtd)
protected static void setHTMLEntities(DTD dtd)
protected static java.lang.String[] append(java.lang.String s1,
java.lang.String[] s2)
protected static java.lang.String[] append(java.lang.String[] s1,
java.lang.String s2)
protected static java.lang.String[] append(java.lang.String[] s1,
java.lang.String[] s2)
public static void main(java.lang.String[] args)