public class CssValidator extends Object
Constructor and Description |
---|
CssValidator(Policy policy)
Constructs a validator for CSS selectors, conditions and properties based
on the given policy.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isValidCondition(String selectorName,
org.w3c.css.sac.Condition condition)
Determines whether the given condition is valid according to this
validator's policy.
|
boolean |
isValidProperty(String name,
org.w3c.css.sac.LexicalUnit lu)
Determines whether the given property (both name and value) are valid
according to this validator's policy.
|
boolean |
isValidSelector(String selectorName,
org.w3c.css.sac.Selector selector)
Determines whether the given selector name is valid according to this
validator's policy.
|
String |
lexicalValueToString(org.w3c.css.sac.LexicalUnit lu)
Converts the given lexical unit to a
String
representation. |
public CssValidator(Policy policy)
policy
- the policy file to use in this validatorpublic boolean isValidProperty(String name, org.w3c.css.sac.LexicalUnit lu)
name
- the name of the propertylu
- the value of the propertypublic boolean isValidSelector(String selectorName, org.w3c.css.sac.Selector selector) throws ScanException
selectorName
- the name of the selectorselector
- the object representation of the selectorScanException
- When there is a problem encountered
while scanning this selectorpublic boolean isValidCondition(String selectorName, org.w3c.css.sac.Condition condition) throws ScanException
selectorName
- the name of the selector that contains this conditioncondition
- the object representation of this conditionScanException
- When there is a problem encountered
while scanning this conditionpublic String lexicalValueToString(org.w3c.css.sac.LexicalUnit lu)
String
representation. This method does not perform any validation - it is meant
to be used in conjunction with the validator/logging methods.lu
- the lexical unit to convertString
representation of the given lexical unitCopyright © 2022. All rights reserved.