Class Tag

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

public class Tag extends 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 Details

  • Method Details

    • getAction

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

      public boolean isAction(String action)
      Indicates if the action for this tag matches the supplied action
      Parameters:
      action - The action to match against
      Returns:
      True if it matches
    • mutateAction

      public Tag mutateAction(String action)
    • getRegularExpression

      public 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 "<hr(\s)*(width='((\w){2,3}(\%)*)'>"
    • getName

      public String getName()
      Returns:
      The String name of the tag.
    • getAttributeByName

      public Attribute getAttributeByName(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