org.apache.wicket.protocol.http.documentvalidation
Class HtmlDocumentParser

java.lang.Object
  extended by org.apache.wicket.protocol.http.documentvalidation.HtmlDocumentParser

public class HtmlDocumentParser
extends java.lang.Object

Lightweight document parser for HTML. This parser is only intended to process well formed and simple HTML of the kind that would generally be utilized during testing.

Author:
Chris Turner

Field Summary
static int CLOSE_TAG
          Constant for close tag token.
static int COMMENT
          Constant for comment token.
static int END
          Constant for end token.
static int OPEN_TAG
          Constant for open tag token.
static int OPENCLOSE_TAG
          Constant for open/close tag token.
static int TEXT
          Constant for text token.
static int UNKNOWN
          constant for unknown token.
 
Constructor Summary
HtmlDocumentParser(java.lang.String document)
          Create the parser for the current document.
 
Method Summary
 java.util.Map getAttributes()
          Get the attributes of the tag.
 java.lang.String getComment()
          Get the comment.
 int getNextToken()
          Iterates through the document searching for tokens.
 java.lang.String getTag()
          Get the tag name.
 java.lang.String getText()
          Get the text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLOSE_TAG

public static final int CLOSE_TAG
Constant for close tag token.

See Also:
Constant Field Values

COMMENT

public static final int COMMENT
Constant for comment token.

See Also:
Constant Field Values

END

public static final int END
Constant for end token.

See Also:
Constant Field Values

OPEN_TAG

public static final int OPEN_TAG
Constant for open tag token.

See Also:
Constant Field Values

OPENCLOSE_TAG

public static final int OPENCLOSE_TAG
Constant for open/close tag token.

See Also:
Constant Field Values

TEXT

public static final int TEXT
Constant for text token.

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
constant for unknown token.

See Also:
Constant Field Values
Constructor Detail

HtmlDocumentParser

public HtmlDocumentParser(java.lang.String document)
Create the parser for the current document.

Parameters:
document - The document to parse
Method Detail

getAttributes

public java.util.Map getAttributes()
Get the attributes of the tag.

Returns:
The attributes

getComment

public java.lang.String getComment()
Get the comment.

Returns:
The comment

getNextToken

public int getNextToken()
Iterates through the document searching for tokens. Returns the type of token that was found. If an unexpected token was encountered then the parser writes this fact to the console and continues

Returns:
The token that was found

getTag

public java.lang.String getTag()
Get the tag name.

Returns:
The tag name

getText

public java.lang.String getText()
Get the text.

Returns:
The text


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.