Class HtmlSimpleParser
java.lang.Object
de.hybris.platform.commons.translator.parsers.AbstractParser
de.hybris.platform.commons.translator.parsers.HtmlSimpleParser
- Direct Known Subclasses:
HtmlListParser,HtmlTableParser
HtmlSimpleParser is a simple implementation of the AbstractParser used by Translator to search
html tags. Additionally this parser store data about all attributes that are inside tags (like width, style or
class).-
Field Summary
Fields inherited from class de.hybris.platform.commons.translator.parsers.AbstractParser
end, name, start -
Constructor Summary
ConstructorsConstructorDescriptionHtmlSimpleParser(String name, String start, String end) standard constructor implementation -
Method Summary
Modifier and TypeMethodDescriptioncreateNode(String start, String end, String text, Translator translator) CreateAbstractNodeinstance from a given textgenerateAttributes(String tag) serach for pairs attributeKey="attributeValue" in textgetEndExpression(String start) convert end parameter to exprresion
that is used to find closing tagconvert start parameter to exprresion
that is used to check if tag has separate closing tag
or is already closedconvert start parameter to exprresion
that is used to find starting tag
-
Constructor Details
-
HtmlSimpleParser
public HtmlSimpleParser() -
HtmlSimpleParser
standard constructor implementation- Parameters:
name-start-end-
-
-
Method Details
-
createNode
Description copied from class:AbstractParserCreateAbstractNodeinstance from a given text- Specified by:
createNodein classAbstractParser- Parameters:
start- is a String that was found when searching for a start of text that should be used to create nodeend- is a String that was found when searching for a end of text that should be used to create nodetext- text is whole text that was between start and end Stringstranslator- reference toTranslatorthat would be used to search for sub tags in giventext- Returns:
- SimpleNode
-
getStartExpression
convert start parameter to exprresion
that is used to find starting tag- Specified by:
getStartExpressionin classAbstractParser- Returns:
- regular expression that would be used to search for beginning of text from which node would be created
-
getStartEndExpression
convert start parameter to exprresion
that is used to check if tag has separate closing tag
or is already closed- Specified by:
getStartEndExpressionin classAbstractParser- Returns:
- regular expression that would be used to check if beginning of text is not also the finishing one ( like br html tag which have no separate closing tag)
-
getEndExpression
convert end parameter to exprresion
that is used to find closing tag- Specified by:
getEndExpressionin classAbstractParser- Returns:
- regular expression that would be used to search for closing tag for a given start expression.
-
generateAttributes
serach for pairs attributeKey="attributeValue" in text- Parameters:
tag-
-