jodd.lagarto
Class LagartoParser

java.lang.Object
  extended by jodd.lagarto.LagartoParser

public class LagartoParser
extends java.lang.Object

Parses HTML text and invokes TagVisitor.


Constructor Summary
LagartoParser(char[] charArray)
           
LagartoParser(java.nio.CharBuffer input)
           
LagartoParser(java.lang.CharSequence charSequence)
           
 
Method Summary
protected  void _parse()
          Main parsing loop that process lexer tokens.
protected  boolean acceptTag(java.lang.String tagName)
          Returns true if some tag has to be parsed.
protected  void error(java.lang.String message)
          Prepares error message and reports it to the visitor.
protected  void flushText()
          Flushes buffered text and stops buffering.
protected  Token nextToken()
          Returns the next token from lexer or previously fetched token.
 void parse(TagVisitor visitor)
          Parses provided content using HTML style.
 void parse(TagVisitor visitor, boolean parseHtmlStyle)
          Parses provided content.
protected  void parseAttribute()
          Parses single attribute.
protected  void parseCCEnd()
          Parses conditional comment end.
protected  void parseCCStart()
          Parses conditional comment start.
protected  void parseCDATA()
          Parses CDATA.
protected  void parseComment()
          Parses HTML comments.
protected  void parseDoctype()
          Parses HTML DOCTYPE directive.
protected  void parseSpecialTag(int state)
          Parses special tags.
protected  void parseTag(Token tagToken, TagType type)
          Parse tag starting from "<".
protected  void parseTagAndAttributes(Token tagToken, java.lang.String tagName, TagType type, int start)
          Parses full tag.
protected  void parseText(int start, int end)
          Buffers the parsed text.
protected  void skipWhiteSpace()
          Skips all whitespace tokens.
protected  java.lang.CharSequence text()
          Returns current text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LagartoParser

public LagartoParser(char[] charArray)

LagartoParser

public LagartoParser(java.lang.CharSequence charSequence)

LagartoParser

public LagartoParser(java.nio.CharBuffer input)
Method Detail

parse

public void parse(TagVisitor visitor)
Parses provided content using HTML style.


parse

public void parse(TagVisitor visitor,
                  boolean parseHtmlStyle)
Parses provided content.


_parse

protected void _parse()
               throws java.io.IOException
Main parsing loop that process lexer tokens.

Throws:
java.io.IOException

flushText

protected void flushText()
Flushes buffered text and stops buffering.


parseText

protected void parseText(int start,
                         int end)
Buffers the parsed text. Buffered text will be consumed on the very next flushText().


parseComment

protected void parseComment()
                     throws java.io.IOException
Parses HTML comments.

Throws:
java.io.IOException

parseCDATA

protected void parseCDATA()
                   throws java.io.IOException
Parses CDATA.

Throws:
java.io.IOException

parseDoctype

protected void parseDoctype()
                     throws java.io.IOException
Parses HTML DOCTYPE directive.

Throws:
java.io.IOException

parseCCStart

protected void parseCCStart()
                     throws java.io.IOException
Parses conditional comment start.

Throws:
java.io.IOException

parseCCEnd

protected void parseCCEnd()
                   throws java.io.IOException
Parses conditional comment end.

Throws:
java.io.IOException

parseTag

protected void parseTag(Token tagToken,
                        TagType type)
                 throws java.io.IOException
Parse tag starting from "<".

Throws:
java.io.IOException

acceptTag

protected boolean acceptTag(java.lang.String tagName)
Returns true if some tag has to be parsed. User may override this method to gain more control over what should be parsed. May be used in situations where only few specific tags has to be parsed (e.g. just title and body).


parseTagAndAttributes

protected void parseTagAndAttributes(Token tagToken,
                                     java.lang.String tagName,
                                     TagType type,
                                     int start)
                              throws java.io.IOException
Parses full tag.

Throws:
java.io.IOException

parseAttribute

protected void parseAttribute()
                       throws java.io.IOException
Parses single attribute.

Throws:
java.io.IOException

parseSpecialTag

protected void parseSpecialTag(int state)
                        throws java.io.IOException
Parses special tags.

Throws:
java.io.IOException

nextToken

protected Token nextToken()
                   throws java.io.IOException
Returns the next token from lexer or previously fetched token.

Throws:
java.io.IOException

skipWhiteSpace

protected void skipWhiteSpace()
                       throws java.io.IOException
Skips all whitespace tokens.

Throws:
java.io.IOException

text

protected java.lang.CharSequence text()
Returns current text.


error

protected void error(java.lang.String message)
Prepares error message and reports it to the visitor.



Copyright © 2003-2011 Jodd Team