Class CssRuleSetParser
java.lang.Object
com.itextpdf.styledxmlparser.css.parse.CssRuleSetParser
Utilities class to parse CSS rule sets.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
getSemicolonPosition
(String propertiesStr, int fromIndex) Gets the semicolon position.static List
<CssDeclaration> parsePropertyDeclarations
(String propertiesStr) Parses property declarations.static List
<CssRuleSet> parseRuleSet
(String selectorStr, String propertiesStr) Parses a rule set into a list ofCssRuleSet
instances.private static String[]
splitCssProperty
(String property) Splits CSS properties into an array ofString
values.
-
Field Details
-
logger
private static final org.slf4j.Logger loggerThe logger.
-
-
Constructor Details
-
CssRuleSetParser
private CssRuleSetParser()Creates a newCssRuleSetParser
instance.
-
-
Method Details
-
parsePropertyDeclarations
Parses property declarations.- Parameters:
propertiesStr
- the property declarations in the form of aString
- Returns:
- the list of
CssDeclaration
instances
-
parseRuleSet
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
-
splitCssProperty
Splits CSS properties into an array ofString
values.- Parameters:
property
- the properties- Returns:
- the array of property values
-
getSemicolonPosition
Gets the semicolon position.- Parameters:
propertiesStr
- the propertiesfromIndex
- the from index- Returns:
- the semicolon position
-