org.htmlcleaner
Class TagNode

java.lang.Object
  extended by org.htmlcleaner.TagToken
      extended by org.htmlcleaner.TagNode
All Implemented Interfaces:
java.lang.Cloneable, BaseToken
Direct Known Subclasses:
HTMLTag

public class TagNode
extends TagToken

XML node node tag - it is produced during cleaning process when all start and end tokens are removed and replaced by instances of TagNode.

Created by: Vladimir Nikic
Date: November, 2006.
Modified by: Axel Kramer


Field Summary
static java.lang.String[] ALLOWED_ATTRIBUTES
          Allowed attributes Note: the 'style' attribute isn't allowed by default because of XSS risks; if you need this attribute (or other attributes not listed here) you can add it with the static addAllowedAttribute() method.
 
Constructor Summary
TagNode()
           
TagNode(java.lang.String name)
           
 
Method Summary
static boolean addAllowedAttribute(java.lang.String key)
          Add an additional allowed attribute name Note: the 'style' attribute isn't allowed by default because of XSS risks; if you need this attribute (or other attributes not listed here) you can add it with this method.
 boolean addAttribute(java.lang.String attName, java.lang.String attValue, boolean checkXSS)
          Add an attribute to this tag.
 void addChild(java.lang.Object child)
           
 void addChildren(java.util.List children)
           
 void addItemForMoving(java.lang.Object item)
           
 void addObjectAttribute(java.lang.String attName, java.lang.Object attValue)
           
 java.lang.Object clone()
           
static java.util.Set<java.lang.String> getAllowedAttributes()
           
 java.util.Map<java.lang.String,java.lang.String> getAttributes()
           
 java.lang.String getBodyString()
          Get the pure content text without the tags from this HTMLTag
 java.util.List getChildren()
           
 java.util.List getItemsToMove()
           
 java.util.Map<java.lang.String,java.lang.Object> getObjectAttributes()
           
 TagNode getParent()
           
 java.lang.String getParents()
          Get the allowed parent tags for this tag
 boolean isFormed()
           
 TagNode makeCopy()
           
static boolean removeAllowedAttribute(java.lang.String key)
           
 void serialize(XmlSerializer xmlSerializer)
           
 void setFormed()
           
 void setItemsToMove(java.util.List itemsToMove)
           
 void setParent(TagNode parent)
           
 
Methods inherited from class org.htmlcleaner.TagToken
equals, getName, getOriginalSource, hashCode, isReduceTokenStack, setName, setOriginalSource, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALLOWED_ATTRIBUTES

public static final java.lang.String[] ALLOWED_ATTRIBUTES
Allowed attributes Note: the 'style' attribute isn't allowed by default because of XSS risks; if you need this attribute (or other attributes not listed here) you can add it with the static addAllowedAttribute() method.

Constructor Detail

TagNode

public TagNode()

TagNode

public TagNode(java.lang.String name)
Method Detail

getAllowedAttributes

public static java.util.Set<java.lang.String> getAllowedAttributes()

removeAllowedAttribute

public static boolean removeAllowedAttribute(java.lang.String key)

addAllowedAttribute

public static boolean addAllowedAttribute(java.lang.String key)
Add an additional allowed attribute name Note: the 'style' attribute isn't allowed by default because of XSS risks; if you need this attribute (or other attributes not listed here) you can add it with this method.


getAttributes

public java.util.Map<java.lang.String,java.lang.String> getAttributes()

getObjectAttributes

public java.util.Map<java.lang.String,java.lang.Object> getObjectAttributes()

getChildren

public java.util.List getChildren()

getParent

public TagNode getParent()

setParent

public void setParent(TagNode parent)

addAttribute

public boolean addAttribute(java.lang.String attName,
                            java.lang.String attValue,
                            boolean checkXSS)
Description copied from class: TagToken
Add an attribute to this tag.

Specified by:
addAttribute in class TagToken
Parameters:
attName - the attribute name
attValue - the attribute's value string
checkXSS - check the attributes for allowed names to avoid cross side scripting
Returns:

addObjectAttribute

public void addObjectAttribute(java.lang.String attName,
                               java.lang.Object attValue)

addChild

public void addChild(java.lang.Object child)

addChildren

public void addChildren(java.util.List children)

addItemForMoving

public void addItemForMoving(java.lang.Object item)

getItemsToMove

public java.util.List getItemsToMove()

setItemsToMove

public void setItemsToMove(java.util.List itemsToMove)

isFormed

public boolean isFormed()

setFormed

public void setFormed()

serialize

public void serialize(XmlSerializer xmlSerializer)
               throws java.io.IOException
Throws:
java.io.IOException

makeCopy

public TagNode makeCopy()

clone

public java.lang.Object clone()
Overrides:
clone in class TagToken

getParents

public java.lang.String getParents()
Description copied from class: TagToken
Get the allowed parent tags for this tag

Specified by:
getParents in class TagToken
Returns:
null if no parent tags are allowed

getBodyString

public java.lang.String getBodyString()
Get the pure content text without the tags from this HTMLTag

Returns: