info.bliki.htmlcleaner
Class TagNode

java.lang.Object
  extended by info.bliki.htmlcleaner.TagToken
      extended by info.bliki.htmlcleaner.TagNode
All Implemented Interfaces:
BaseToken, java.lang.Cloneable
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.
protected static java.util.HashSet<java.lang.String> ALLOWED_ATTRIBUTES_SET
           
 
Fields inherited from class info.bliki.htmlcleaner.TagToken
name, originalSource
 
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<? extends java.lang.Object> children)
           
 void addItemForMoving(BaseToken item)
           
 void addObjectAttribute(java.lang.String attName, java.lang.Object attValue)
          Add a special object to this TagNode which contains original information from the parsed wiki object (for example the ImageFormat or original wiki topic string)
 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
 void getBodyString(java.lang.Appendable buf)
          Get the pure content text without the tags from this HTMLTag
 java.util.List<java.lang.Object> getChildren()
           
 java.util.List<java.lang.Object> getItemsToMove()
           
 java.util.Map<java.lang.String,java.lang.Object> getObjectAttributes()
          Get a special object for this TagNode which contains original information from the parsed wiki object (for example the ImageFormat or original wiki topic string).
 TagNode getParent()
           
 java.lang.String getParents()
          Get the allowed parent tags for this tag
 boolean isAllowedAttribute(java.lang.String attName)
          Check, if the attName is allowed.
 boolean isFormed()
           
 TagNode makeCopy()
           
static boolean removeAllowedAttribute(java.lang.String key)
           
 void serialize(XmlSerializer xmlSerializer)
           
 void setFormed()
           
 void setItemsToMove(java.util.List<java.lang.Object> itemsToMove)
           
 void setParent(TagNode parent)
           
 
Methods inherited from class info.bliki.htmlcleaner.TagToken
equals, getName, getOriginalSource, hashCode, isReduceTokenStack, setName, setOriginalSource, toString
 
Methods inherited from class java.lang.Object
finalize, 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.


ALLOWED_ATTRIBUTES_SET

protected static final java.util.HashSet<java.lang.String> ALLOWED_ATTRIBUTES_SET
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()
Get a special object for this TagNode which contains original information from the parsed wiki object (for example the ImageFormat or original wiki topic string).

Parameters:
attName - the attribute name
attValue - the attribute value
See Also:
addObjectAttribute(String, Object), ImageFormat

getChildren

public java.util.List<java.lang.Object> 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:

isAllowedAttribute

public boolean isAllowedAttribute(java.lang.String attName)
Description copied from class: TagToken
Check, if the attName is allowed.

Specified by:
isAllowedAttribute in class TagToken
Returns:

addObjectAttribute

public void addObjectAttribute(java.lang.String attName,
                               java.lang.Object attValue)
Add a special object to this TagNode which contains original information from the parsed wiki object (for example the ImageFormat or original wiki topic string)

Parameters:
attName - the attribute name
attValue - the attribute value
See Also:
getObjectAttributes(), ImageFormat

addChild

public void addChild(java.lang.Object child)

addChildren

public void addChildren(java.util.List<? extends java.lang.Object> children)

addItemForMoving

public void addItemForMoving(BaseToken item)

getItemsToMove

public java.util.List<java.lang.Object> getItemsToMove()

setItemsToMove

public void setItemsToMove(java.util.List<java.lang.Object> 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 void getBodyString(java.lang.Appendable buf)
                   throws java.io.IOException
Get the pure content text without the tags from this HTMLTag

Throws:
java.io.IOException

getBodyString

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

Returns:


Copyright © 2012 Java Wikipedia API (Bliki engine). All Rights Reserved.