A helper class that simplifies the parsing of stylesheets.
parseLexicalStyleValue
public LexicalUnit parseLexicalStyleValue(String value)
Parses an single lexical unit. This returns the un-interpreted tokenized
value. The only use this method has is to parse performance critical
tokens.
value
- the value as string.
- the parsed value or null, if the string was unparseable.
parseNamespaceIdent
public static String[] parseNamespaceIdent(String attrName)
Parses a single namespace identifier. This simply splits the given
attribute name when a namespace separator is encountered ('|').
attrName
- the attribute name
parseSelector
public SelectorList parseSelector(Map namespaces,
String selector,
ResourceManager resourceManager,
ResourceKey baseURL)
Parses a single style value for the given key. Returns null
,
if the key denotes a compound definition, which has no internal
representation.
namespaces
- an optional map of known namespaces (prefix -> uri)selector
- the selector text that should be parsed.resourceManager
- an optional resource managerbaseURL
- an optional base url
- the parsed selector or null
parseStyleRule
public CSSDeclarationRule parseStyleRule(Map namespaces,
String styleText,
ResourceManager resourceManager,
ResourceKey baseURL,
CSSDeclarationRule baseRule)
Parses a style rule.
namespaces
- an optional map of known namespaces (prefix -> uri)styleText
- the css text that should be parsedresourceManager
- an optional resource managerbaseURL
- an optional base urlbaseRule
- an optional base-rule to which the result gets added.
- the CSS-Style-Rule that contains all values for the given text.
parseStyleValue
public CSSValue parseStyleValue(Map namespaces,
StyleKey key,
String value,
ResourceManager resourceManager,
ResourceKey baseURL)
Parses a single style value for the given key. Returns null
,
if the key denotes a compound definition, which has no internal
representation.
namespaces
- an optional map of known namespaces (prefix -> uri)key
- the stylekey to which the value should be assigned.value
- the value textresourceManager
- an optional resource managerbaseURL
- an optional base url
- the parsed value or null, if the value was not valid.
parseStyles
public CSSStyleRule parseStyles(Map namespaces,
String name,
String value,
ResourceManager resourceManager,
ResourceKey baseURL)
Parses a style value. If the style value is a compound key, the
corresonding style entries will be added to the style rule.
namespaces
- an optional map of known namespaces (prefix -> uri)name
- the stylekey-name to which the value should be assigned.value
- the value textresourceManager
- an optional resource managerbaseURL
- an optional base url
- the CSS-Style-Rule that contains all values for the given text.
parseStyles
public CSSStyleRule parseStyles(Map namespaces,
String name,
String value,
ResourceManager resourceManager,
ResourceKey baseURL,
CSSDeclarationRule baseRule)
Parses a style value. If the style value is a compound key, the
corresonding style entries will be added to the style rule.
namespaces
- an optional map of known namespaces (prefix -> uri)name
- the stylekey-name to which the value should be assigned.value
- the value textresourceManager
- an optional resource managerbaseURL
- an optional base urlbaseRule
- an optional base-rule to which the result gets added.
- the CSS-Style-Rule that contains all values for the given text.
parseStyles
public CSSStyleRule parseStyles(Map namespaces,
StyleKey key,
String value,
ResourceManager resourceManager,
ResourceKey baseURL)
Parses a style value. If the style value is a compound key, the
corresonding style entries will be added to the style rule.
namespaces
- an optional map of known namespaces (prefix -> uri)key
- the stylekey to which the value should be assigned.value
- the value textresourceManager
- an optional resource managerbaseURL
- an optional base url
- the CSS-Style-Rule that contains all values for the given text.