Class HtmlSimpleParser

java.lang.Object
de.hybris.platform.commons.translator.parsers.AbstractParser
de.hybris.platform.commons.translator.parsers.HtmlSimpleParser
Direct Known Subclasses:
HtmlListParser, HtmlTableParser

public class HtmlSimpleParser extends AbstractParser
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).
  • Constructor Details

    • HtmlSimpleParser

      public HtmlSimpleParser()
    • HtmlSimpleParser

      public HtmlSimpleParser(String name, String start, String end)
      standard constructor implementation
      Parameters:
      name -
      start -
      end -
  • Method Details

    • createNode

      public AbstractNode createNode(String start, String end, String text, Translator translator)
      Description copied from class: AbstractParser
      Create AbstractNode instance from a given text
      Specified by:
      createNode in class AbstractParser
      Parameters:
      start - is a String that was found when searching for a start of text that should be used to create node
      end - is a String that was found when searching for a end of text that should be used to create node
      text - text is whole text that was between start and end Strings
      translator - reference to Translator that would be used to search for sub tags in given text
      Returns:
      SimpleNode
    • getStartExpression

      public String getStartExpression()
      convert start parameter to exprresion
      that is used to find starting tag
      Specified by:
      getStartExpression in class AbstractParser
      Returns:
      regular expression that would be used to search for beginning of text from which node would be created
    • getStartEndExpression

      public String getStartEndExpression()
      convert start parameter to exprresion
      that is used to check if tag has separate closing tag
      or is already closed
      Specified by:
      getStartEndExpression in class AbstractParser
      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

      public String getEndExpression(String start)
      convert end parameter to exprresion
      that is used to find closing tag
      Specified by:
      getEndExpression in class AbstractParser
      Returns:
      regular expression that would be used to search for closing tag for a given start expression.
    • generateAttributes

      public Map generateAttributes(String tag)
      serach for pairs attributeKey="attributeValue" in text
      Parameters:
      tag -