Package org.w3c.tidy
Class ParserImpl
- java.lang.Object
-
- org.w3c.tidy.ParserImpl
-
public final class ParserImpl extends java.lang.Object
HTML Parser implementation.- Version:
- $Revision: 813 $ ($Author: eunyee $)
- 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 class
ParserImpl.ParseBlock
Parser for block elements.static class
ParserImpl.ParseBody
Parser for BODY.static class
ParserImpl.ParseColGroup
Parser for COLGROUP.static class
ParserImpl.ParseDefList
Parser for DEFLIST.static class
ParserImpl.ParseEmpty
Parser for empty elements.static class
ParserImpl.ParseFrameSet
Parser for FRAMESET.static class
ParserImpl.ParseHead
Parser for HEAD.static class
ParserImpl.ParseHTML
Parser for HTML.static class
ParserImpl.ParseInline
Parser for INLINE.static class
ParserImpl.ParseList
Parser for LIST.static class
ParserImpl.ParseNoFrames
Parser for NOFRAMES.static class
ParserImpl.ParseOptGroup
Parser for OPTGROUP.static class
ParserImpl.ParsePre
Parser for PRE.static class
ParserImpl.ParseRow
Parser for ROW.static class
ParserImpl.ParseRowGroup
Parser for ROWGROUP.static class
ParserImpl.ParseScript
Parser for SCRIPT.static class
ParserImpl.ParseSelect
Parser for SELECT.static class
ParserImpl.ParseTableTag
Parser for TABLE.static class
ParserImpl.ParseText
Parser for text nodes.static class
ParserImpl.ParseTitle
Parser for TITLE.
-
Field Summary
Fields Modifier and Type Field Description static Parser
BLOCK
parser for block elements.static Parser
BODY
parser for body.static Parser
COLGROUP
parser for colgroup.static Parser
DEFLIST
parser for definition lists.static Parser
EMPTY
parser for empty elements.static Parser
FRAMESET
parser for frameset.static Parser
HEAD
parser for head.static Parser
HTML
parser for html.static Parser
INLINE
parser for inline.static Parser
LIST
parser for list.static Parser
NOFRAMES
parser for noframes.static Parser
OPTGROUP
parser for optgroup.static Parser
PRE
parser for pre.static Parser
ROW
parser for row.static Parser
ROWGROUP
parser for rowgroup.static Parser
SCRIPT
parser for script.static Parser
SELECT
parser for select.static Parser
TABLETAG
parser for table.static Parser
TEXT
parser for text.static Parser
TITLE
parser for title.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static void
moveToHead(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 Node
parseDocument(Lexer lexer)
HTML is the top level element.protected static void
parseTag(Lexer lexer, Node node, short mode, int nestingLevel)
static Node
parseXMLDocument(Lexer lexer)
static void
parseXMLElement(Lexer lexer, Node element, short mode)
XML documents.static boolean
XMLPreserveWhiteSpace(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
- 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
-element
-node
-- Throws:
ExcessiveNesting
-
XMLPreserveWhiteSpace
public static boolean XMLPreserveWhiteSpace(Node element, TagTable tt)
Indicates whether or not whitespace should be preserved for this element. If anxml:space
attribute is found, then if the attribute value ispreserve
, returnstrue
. For any other value, returnsfalse
. If anxml:space
attribute was not found, then the following element names result in a return value oftrue: pre, script, style,
andxsl:text
. Finally, if aTagTable
was passed in and the element appears as the "pre" element in theTagTable
, thentrue
will be returned. Otherwise,false
is returned.- Parameters:
element
- TheNode
to test to see if whitespace should be preserved.tt
- TheTagTable
to test for thegetNodePre()
function. This may benull
, in which case this test is bypassed.- Returns:
true
orfalse
, as explained above.
-
parseXMLElement
public static void parseXMLElement(Lexer lexer, Node element, short mode)
XML documents.
-
-