Class CssRuleSetParser
- java.lang.Object
-
- com.itextpdf.styledxmlparser.css.parse.CssRuleSetParser
-
public final class CssRuleSetParser extends java.lang.Object
Utilities class to parse CSS rule sets.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
logger
The logger.
-
Constructor Summary
Constructors Modifier Constructor Description private
CssRuleSetParser()
Creates a newCssRuleSetParser
instance.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
getSemicolonPosition(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 ofCssRuleSet
instances.(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 ofString
values.
-
-
-
Constructor Detail
-
CssRuleSetParser
private CssRuleSetParser()
Creates a newCssRuleSetParser
instance.
-
-
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
CssDeclaration
instances
-
parseRuleSet
public static java.util.List<CssRuleSet> parseRuleSet(java.lang.String selectorStr, java.lang.String propertiesStr)
Parses a rule set into a list ofCssRuleSet
instances. This method returns aList
because a selector can be compound, like "p, div, #navbar".- Parameters:
selectorStr
- the selectorpropertiesStr
- the properties- Returns:
- the resulting list of
CssRuleSet
instances
-
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 ofString
values.- 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
-
-