Package org.w3c.tidy
Class ParserImpl
- java.lang.Object
-
- org.w3c.tidy.ParserImpl
-
public final class ParserImpl extends java.lang.ObjectHTML Parser implementation.- Version:
- $Revision$ ($Author$)
- Author:
- Dave Raggett dsr@w3.org , Andy Quick ac.quick@sympatico.ca (translation to Java), Fabrizio Giustina
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParserImpl.ParseBlockParser for block elements.static classParserImpl.ParseBodyParser for BODY.static classParserImpl.ParseColGroupParser for COLGROUP.static classParserImpl.ParseDefListParser for DEFLIST.static classParserImpl.ParseEmptyParser for empty elements.static classParserImpl.ParseFrameSetParser for FRAMESET.static classParserImpl.ParseHeadParser for HEAD.static classParserImpl.ParseHTMLParser for HTML.static classParserImpl.ParseInlineParser for INLINE.static classParserImpl.ParseListParser for LIST.static classParserImpl.ParseNoFramesParser for NOFRAMES.static classParserImpl.ParseOptGroupParser for OPTGROUP.static classParserImpl.ParsePreParser for PRE.static classParserImpl.ParseRowParser for ROW.static classParserImpl.ParseRowGroupParser for ROWGROUP.static classParserImpl.ParseScriptParser for SCRIPT.static classParserImpl.ParseSelectParser for SELECT.static classParserImpl.ParseTableTagParser for TABLE.static classParserImpl.ParseTextParser for text nodes.static classParserImpl.ParseTitleParser for TITLE.
-
Field Summary
Fields Modifier and Type Field Description static ParserBLOCKparser for block elements.static ParserBODYparser for body.static ParserCOLGROUPparser for colgroup.static ParserDEFLISTparser for definition lists.static ParserEMPTYparser for empty elements.static ParserFRAMESETparser for frameset.static ParserHEADparser for head.static ParserHTMLparser for html.static ParserINLINEparser for inline.static ParserLISTparser for list.static ParserNOFRAMESparser for noframes.static ParserOPTGROUPparser for optgroup.static ParserPREparser for pre.static ParserROWparser for row.static ParserROWGROUPparser for rowgroup.static ParserSCRIPTparser for script.static ParserSELECTparser for select.static ParserTABLETAGparser for table.static ParserTEXTparser for text.static ParserTITLEparser for title.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidmoveToHead(Lexer lexer, Node element, Node node, int nestingLevel)Move node to the head, where element is used as starting point in hunt for head.static NodeparseDocument(Lexer lexer)HTML is the top level element.protected static voidparseTag(Lexer lexer, Node node, short mode, int nestingLevel)Parse tag.static NodeparseXMLDocument(Lexer lexer)Parse xml document.static voidparseXMLElement(Lexer lexer, Node element, short mode)Parse XML element.static booleanXMLPreserveWhiteSpace(Node element, TagTable tt)Indicates whether or not whitespace should be preserved for this element.
-
-
-
Field Detail
-
HTML
public static final Parser HTML
parser for html.
-
HEAD
public static final Parser HEAD
parser for head.
-
TITLE
public static final Parser TITLE
parser for title.
-
SCRIPT
public static final Parser SCRIPT
parser for script.
-
BODY
public static final Parser BODY
parser for body.
-
FRAMESET
public static final Parser FRAMESET
parser for frameset.
-
INLINE
public static final Parser INLINE
parser for inline.
-
LIST
public static final Parser LIST
parser for list.
-
DEFLIST
public static final Parser DEFLIST
parser for definition lists.
-
PRE
public static final Parser PRE
parser for pre.
-
BLOCK
public static final Parser BLOCK
parser for block elements.
-
TABLETAG
public static final Parser TABLETAG
parser for table.
-
COLGROUP
public static final Parser COLGROUP
parser for colgroup.
-
ROWGROUP
public static final Parser ROWGROUP
parser for rowgroup.
-
ROW
public static final Parser ROW
parser for row.
-
NOFRAMES
public static final Parser NOFRAMES
parser for noframes.
-
SELECT
public static final Parser SELECT
parser for select.
-
TEXT
public static final Parser TEXT
parser for text.
-
EMPTY
public static final Parser EMPTY
parser for empty elements.
-
OPTGROUP
public static final Parser OPTGROUP
parser for optgroup.
-
-
Method Detail
-
parseTag
protected static void parseTag(Lexer lexer, Node node, short mode, int nestingLevel) throws ExcessiveNesting
Parse tag.- Parameters:
lexer- the Lexer to usenode- the node to usemode- the mode to usenestingLevel- The current nesting level of the document. Extremely nested documents are considered an error.- Throws:
ExcessiveNesting- When excessive nesting is detected.
-
moveToHead
protected static void moveToHead(Lexer lexer, Node element, Node node, int nestingLevel) throws ExcessiveNesting
Move node to the head, where element is used as starting point in hunt for head. Normally called during parsing.- Parameters:
lexer- the Lexer to useelement- the element to usenode- the node to usenestingLevel- The current nesting level of the document. Extremely nested documents are considered an error.- Throws:
ExcessiveNesting- When excessive nesting is detected.
-
parseDocument
public static Node parseDocument(Lexer lexer)
HTML is the top level element.- Parameters:
lexer- the Lexer to use- Returns:
- the document node
-
XMLPreserveWhiteSpace
public static boolean XMLPreserveWhiteSpace(Node element, TagTable tt)
Indicates whether or not whitespace should be preserved for this element. If anxml:spaceattribute is found, then if the attribute value ispreserve, returnstrue. For any other value, returnsfalse. If anxml:spaceattribute was not found, then the following element names result in a return value oftrue: pre, script, style,andxsl:text. Finally, if aTagTablewas passed in and the element appears as the "pre" element in theTagTable, thentruewill be returned. Otherwise,falseis returned.- Parameters:
element- TheNodeto test to see if whitespace should be preserved.tt- TheTagTableto test for thegetNodePre()function. This may benull, in which case this test is bypassed.- Returns:
trueorfalse, as explained above.
-
parseXMLElement
public static void parseXMLElement(Lexer lexer, Node element, short mode)
Parse XML element.- Parameters:
lexer- the Lexer to useelement- the element to parsemode- the mode to use
-
-