Class CssRuleSetParser
- java.lang.Object
-
- com.itextpdf.styledxmlparser.css.parse.CssRuleSetParser
-
public final class CssRuleSetParser extends java.lang.ObjectUtilities class to parse CSS rule sets.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerloggerThe logger.
-
Constructor Summary
Constructors Modifier Constructor Description privateCssRuleSetParser()Creates a newCssRuleSetParserinstance.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static intgetSemicolonPosition(java.lang.String propertiesStr, int fromIndex)Gets the semicolon position.static java.util.List<CssDeclaration>parsePropertyDeclarations(java.lang.String propertiesStr)Parses property declarations.static java.util.List<CssRuleSet>parseRuleSet(java.lang.String selectorStr, java.lang.String propertiesStr)Parses a rule set into a list ofCssRuleSetinstances.(package private) static java.lang.String[]splitByTokens(java.lang.String selectorGroup)private static java.lang.String[]splitCssProperty(java.lang.String property)Splits CSS properties into an array ofStringvalues.
-
-
-
Constructor Detail
-
CssRuleSetParser
private CssRuleSetParser()
Creates a newCssRuleSetParserinstance.
-
-
Method Detail
-
parsePropertyDeclarations
public static java.util.List<CssDeclaration> parsePropertyDeclarations(java.lang.String propertiesStr)
Parses property declarations.- Parameters:
propertiesStr- the property declarations in the form of aString- Returns:
- the list of
CssDeclarationinstances
-
parseRuleSet
public static java.util.List<CssRuleSet> parseRuleSet(java.lang.String selectorStr, java.lang.String propertiesStr)
Parses a rule set into a list ofCssRuleSetinstances. This method returns aListbecause a selector can be compound, like "p, div, #navbar".- Parameters:
selectorStr- the selectorpropertiesStr- the properties- Returns:
- the resulting list of
CssRuleSetinstances
-
splitByTokens
static java.lang.String[] splitByTokens(java.lang.String selectorGroup)
-
splitCssProperty
private static java.lang.String[] splitCssProperty(java.lang.String property)
Splits CSS properties into an array ofStringvalues.- Parameters:
property- the properties- Returns:
- the array of property values
-
getSemicolonPosition
private static int getSemicolonPosition(java.lang.String propertiesStr, int fromIndex)Gets the semicolon position.- Parameters:
propertiesStr- the propertiesfromIndex- the from index- Returns:
- the semicolon position
-
-