org.owasp.validator.html.model
Class Attribute
java.lang.Object
org.owasp.validator.html.model.Attribute
- All Implemented Interfaces:
- Cloneable
public class Attribute
- extends Object
- implements Cloneable
A model for HTML attributes and the "rules" they must follow (either literals or regular expressions) in
order to be considered valid.
- Author:
- Arshan Dabirsiaghi
Attribute
public Attribute(String name)
addAllowedValue
public void addAllowedValue(String safeValue)
- Parameters:
safeValue - A legal literal value that an attribute can have, according to the Policy
addAllowedRegExp
public void addAllowedRegExp(Pattern safeRegExpValue)
- Parameters:
safeRegExpValue - A legal regular expression value that an attribute could have, according to the Policy
getAllowedRegExp
public List getAllowedRegExp()
- Returns:
- A
List of regular expressions that an attribute can be validated from.
setAllowedRegExp
public void setAllowedRegExp(List allowedRegExp)
- Parameters:
allowedRegExp - A List of regular expressions that an attribute can be validated from.
getAllowedValues
public List getAllowedValues()
- Returns:
- A
List of literal values that an attribute could have, according to the Policy.
setAllowedValues
public void setAllowedValues(List allowedValues)
- Parameters:
allowedValues - A List of regular expressions that an attribute can be validated from.
getName
public String getName()
- Returns:
- The name of an Attribute object.
setName
public void setName(String name)
- Parameters:
name - The new name of an Attribute object.
getOnInvalid
public String getOnInvalid()
- Returns:
- The
onInvalid value a tag could have, from the list of "filterTag", "removeTag" and "removeAttribute"
setOnInvalid
public void setOnInvalid(String onInvalid)
- Parameters:
onInvalid - The new onInvalid value of an Attribute object.
getDescription
public String getDescription()
- Returns:
- The description of what the tag does.
setDescription
public void setDescription(String description)
- Parameters:
description - The new description of what the tag does.
clone
public Object clone()
- We need to implement
clone() to make the Policy file work with common attributes and the ability
to use a common-attribute with an alternative onInvalid action.
- Overrides:
clone in class Object