Class CssRuleSetParser

java.lang.Object
com.itextpdf.styledxmlparser.css.parse.CssRuleSetParser

public final class CssRuleSetParser extends Object
Utilities class to parse CSS rule sets.
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
      The logger.
  • Constructor Details

    • CssRuleSetParser

      private CssRuleSetParser()
      Creates a new CssRuleSetParser instance.
  • Method Details

    • parsePropertyDeclarations

      public static List<CssDeclaration> parsePropertyDeclarations(String propertiesStr)
      Parses property declarations.
      Parameters:
      propertiesStr - the property declarations in the form of a String
      Returns:
      the list of CssDeclaration instances
    • parseRuleSet

      public static List<CssRuleSet> parseRuleSet(String selectorStr, String propertiesStr)
      Parses a rule set into a list of CssRuleSet instances. This method returns a List because a selector can be compound, like "p, div, #navbar".
      Parameters:
      selectorStr - the selector
      propertiesStr - the properties
      Returns:
      the resulting list of CssRuleSet instances
    • splitCssProperty

      private static String[] splitCssProperty(String property)
      Splits CSS properties into an array of String values.
      Parameters:
      property - the properties
      Returns:
      the array of property values
    • getSemicolonPosition

      private static int getSemicolonPosition(String propertiesStr, int fromIndex)
      Gets the semicolon position.
      Parameters:
      propertiesStr - the properties
      fromIndex - the from index
      Returns:
      the semicolon position