org.owasp.validator.html.model
Class Tag

java.lang.Object
  extended by org.owasp.validator.html.model.Tag

public class Tag
extends java.lang.Object

A model for HTML "tags" and the rules dictating their validation/filtration. Also contains information about their allowed attributes. There is also some experimental (unused) code in here for generating a valid regular expression according to a policy file on a per-tag basis.

Author:
Arshan Dabirsiaghi

Constructor Summary
Tag(java.lang.String name)
          Constructor.
 
Method Summary
 void addAttribute(Attribute attr)
          Adds a fully-built Attribute to the list of Attributes allowed for this tag.
 java.lang.String getAction()
           
 java.util.HashMap getAllowedAttributes()
           
 Attribute getAttributeByName(java.lang.String name)
          Returns an Attribute associated with a lookup name.
 java.lang.String getName()
           
 java.lang.String getRegularExpression()
          Returns a regular expression for validating individual tags.
 void setAction(java.lang.String action)
           
 void setAllowedAttributes(java.util.HashMap allowedAttributes)
           
 void setName(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tag

public Tag(java.lang.String name)
Constructor.

Parameters:
name - The name of the tag, such as "b" for <b> tags.
Method Detail

getAction

public java.lang.String getAction()
Returns:
The action for this tag which is one of filter, validate or remove.

setAction

public void setAction(java.lang.String action)
Parameters:
action - The new action for this tag which is one of filter, validate or remove.

addAttribute

public void addAttribute(Attribute attr)
Adds a fully-built Attribute to the list of Attributes allowed for this tag.

Parameters:
attr - The Attribute to add to the list of allowed Attributes.

getRegularExpression

public java.lang.String getRegularExpression()
Returns a regular expression for validating individual tags. Not used by the AntiSamy scanner, but you might find some use for this.

Returns:
A regular expression for the tag, i.e., "^$", or ""

getAllowedAttributes

public java.util.HashMap getAllowedAttributes()
Returns:
A HashMap of allowed attributes that the tag is allowed to contain.

setAllowedAttributes

public void setAllowedAttributes(java.util.HashMap allowedAttributes)
Parameters:
allowedAttributes - The new HashMap of allowed attributes that the tag is allowed to contain.

getName

public java.lang.String getName()
Returns:
The String name of the tag.

setName

public void setName(java.lang.String name)
Parameters:
name - The new name of the tag.

getAttributeByName

public Attribute getAttributeByName(java.lang.String name)
Returns an Attribute associated with a lookup name.

Parameters:
name - The name of the allowed attribute by name.
Returns:
The Attribute object associated with the name, or


Copyright © 2010 The Open Web Application Security Project (OWASP). All Rights Reserved.