Class FastPageParser
java.lang.Object
com.opensymphony.module.sitemesh.parser.FastPageParser
- All Implemented Interfaces:
PageParser
Very fast PageParser implementation for parsing HTML.
Produces FastPage.
- Version:
- $Revision: 1.10 $
- Author:
- Victor Salaman
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate FastPageinternalParse(Reader reader) parse(char[] data) This builds a Page.private static FastPageParser.TagparseProperties(FastPageParser.Tag tag, CharArray buffer) This is called when we need to extract the properties for the tag from the tag's HTML.private FastPageParser.TagparseTag(FastPageParser.Tag tag, CharArray buf) Populates aFastPageParser.Tagobject using data from the suppliedCharArray.private static booleanshouldWriteToHead(int state, int laststate) private static voidwriteTag(int state, int laststate, boolean hide, CharArray _head, CharArray _buffer, CharArray _body)
-
Field Details
-
TOKEN_NONE
private static final int TOKEN_NONE- See Also:
-
TOKEN_EOF
private static final int TOKEN_EOF- See Also:
-
TOKEN_TEXT
private static final int TOKEN_TEXT- See Also:
-
TOKEN_TAG
private static final int TOKEN_TAG- See Also:
-
TOKEN_COMMENT
private static final int TOKEN_COMMENT- See Also:
-
TOKEN_CDATA
private static final int TOKEN_CDATA- See Also:
-
TOKEN_SCRIPT
private static final int TOKEN_SCRIPT- See Also:
-
TOKEN_DOCTYPE
private static final int TOKEN_DOCTYPE- See Also:
-
TOKEN_EMPTYTAG
private static final int TOKEN_EMPTYTAG- See Also:
-
STATE_EOF
private static final int STATE_EOF- See Also:
-
STATE_TEXT
private static final int STATE_TEXT- See Also:
-
STATE_TAG
private static final int STATE_TAG- See Also:
-
STATE_COMMENT
private static final int STATE_COMMENT- See Also:
-
STATE_TAG_QUOTE
private static final int STATE_TAG_QUOTE- See Also:
-
STATE_CDATA
private static final int STATE_CDATA- See Also:
-
STATE_SCRIPT
private static final int STATE_SCRIPT- See Also:
-
STATE_DOCTYPE
private static final int STATE_DOCTYPE- See Also:
-
TAG_STATE_NONE
private static final int TAG_STATE_NONE- See Also:
-
TAG_STATE_HTML
private static final int TAG_STATE_HTML- See Also:
-
TAG_STATE_HEAD
private static final int TAG_STATE_HEAD- See Also:
-
TAG_STATE_TITLE
private static final int TAG_STATE_TITLE- See Also:
-
TAG_STATE_BODY
private static final int TAG_STATE_BODY- See Also:
-
TAG_STATE_XML
private static final int TAG_STATE_XML- See Also:
-
TAG_STATE_XMP
private static final int TAG_STATE_XMP- See Also:
-
SLASH_XML_HASH
private static final int SLASH_XML_HASH- See Also:
-
XML_HASH
private static final int XML_HASH- See Also:
-
SLASH_XMP_HASH
private static final int SLASH_XMP_HASH- See Also:
-
XMP_HASH
private static final int XMP_HASH- See Also:
-
HTML_HASH
private static final int HTML_HASH- See Also:
-
SLASH_HTML_HASH
private static final int SLASH_HTML_HASH- See Also:
-
HEAD_HASH
private static final int HEAD_HASH- See Also:
-
TITLE_HASH
private static final int TITLE_HASH- See Also:
-
SLASH_TITLE_HASH
private static final int SLASH_TITLE_HASH- See Also:
-
PARAMETER_HASH
private static final int PARAMETER_HASH- See Also:
-
META_HASH
private static final int META_HASH- See Also:
-
SLASH_HEAD_HASH
private static final int SLASH_HEAD_HASH- See Also:
-
FRAMESET_HASH
private static final int FRAMESET_HASH- See Also:
-
FRAME_HASH
private static final int FRAME_HASH- See Also:
-
BODY_HASH
private static final int BODY_HASH- See Also:
-
SLASH_BODY_HASH
private static final int SLASH_BODY_HASH- See Also:
-
CONTENT_HASH
private static final int CONTENT_HASH- See Also:
-
-
Constructor Details
-
FastPageParser
public FastPageParser()
-
-
Method Details
-
parse
Description copied from interface:PageParserThis builds a Page.- Specified by:
parsein interfacePageParser- Throws:
IOException
-
parse
-
internalParse
-
writeTag
-
shouldWriteToHead
private static boolean shouldWriteToHead(int state, int laststate) -
parseTag
Populates aFastPageParser.Tagobject using data from the suppliedCharArray. The supplied tag parameter is reset and reused - this avoids excess object creation which hwlps performance.- Returns:
- the same tag instance that was passed in, except it will be populated with a new name value (and the corresponding nameEndIdx value). However if the tag contained nathing but whitespace, this method will return null.
-
parseProperties
This is called when we need to extract the properties for the tag from the tag's HTML. We only call this when necessary since it has quite a lot of overhead.- Parameters:
tag- the tag that is currently being processed. This should be the tag that was returned as a result of a call toparseTag(FastPageParser.Tag, CharArray)(ie, it has the name and nameEndIdx fields set correctly for the tag in question. The properties field can be in an undefined state - it will get replaced regardless).buffer- a CharArray containing the entire tag that is being parsed.- Returns:
- the same tag instance that was passed in, only it will now be populated with any properties that were specified in the tag's HTML.
-