info.bliki.htmlcleaner
Class TagInfo
java.lang.Object
info.bliki.htmlcleaner.TagInfo
public class TagInfo
- extends java.lang.Object
Class contains information about single HTML tag.
It also contains
rules to for tag balancing. For each tag, list of dependant tags may be
defined. In order to more easely describe those rules, several prefixed are
introduced.
For each tag, list of dependant tags may be specified using following
prefixes:
-
!
fatal tag - required outer tag - the tag will be ignored during parsing (will
be skipped) if this fatal tag is missing. For example, most web browsers
ignore elements TD, TR, TBODY if they are not in the context of TABLE tag.
-
+
required enclosing tag - if there is no such, it is implicitely created. For
example if TD is out of TR - open TR is created before.
-
-
permitted tag - it is not allowed to occure inside - for example FORM cannot
be inside other FORM and it will be ignored during cleanup.
-
#
allowed children tags - for example TR allowes TD and TH. If there are some
dependant allowed tags defined then cleaner ignores other tags, treating them
as unallowed, unless they are in some other relationship with this tag.
-
^
higher level tags - for example for TR higher tags are THEAD, TBODY, TFOOT.
-
&
tags that must be closed and copied - for example, in
<a href="#"><div>....
tag A must be closed before
DIV but copied again inside DIV.
Tag TR for instance (table row) may define the following dependancies:
!table,+tbody,^thead,^tfoot,#td,#th,tr,caption,colgroup
meaning the following:
TR must be in context of TABLE, otherwise it will be ignored,
TR may can be directly inside TBODY, TFOOT and THEAD, otherwise TBODY
will be implicitely created in front of it.
TR can contain TD and TD, all other tags and content will be pushed out
of current limiting context, in the case of html tables, in front of
enclosing TABLE tag.
if previous open tag is one of TR, CAPTION or COLGROUP, it will be
implicitely closed.
Created by Vladimir Nikic.
Date: November, 2006
Constructor Summary |
TagInfo(java.lang.String name,
java.lang.String contentType,
int belongsTo,
boolean depricated,
boolean unique,
boolean ignorePermitted,
java.lang.String dependancies)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TagInfo
public TagInfo(java.lang.String name,
java.lang.String contentType,
int belongsTo,
boolean depricated,
boolean unique,
boolean ignorePermitted,
java.lang.String dependancies)
addDependancy
public void addDependancy(java.lang.String dependantTagName)
getName
public java.lang.String getName()
setName
public void setName(java.lang.String name)
getContentType
public java.lang.String getContentType()
setContentType
public void setContentType(java.lang.String contentType)
getMustCloseTags
public java.util.Set getMustCloseTags()
setMustCloseTags
public void setMustCloseTags(java.util.Set mustCloseTags)
getHigherTags
public java.util.Set getHigherTags()
setHigherTags
public void setHigherTags(java.util.Set higherTags)
getChildTags
public java.util.Set getChildTags()
setChildTags
public void setChildTags(java.util.Set childTags)
getPermittedTags
public java.util.Set getPermittedTags()
setPermittedTags
public void setPermittedTags(java.util.Set permittedTags)
getCopyTags
public java.util.Set getCopyTags()
setCopyTags
public void setCopyTags(java.util.Set copyTags)
getRequiredParent
public java.lang.String getRequiredParent()
setRequiredParent
public void setRequiredParent(java.lang.String requiredParent)
getBelongsTo
public int getBelongsTo()
setBelongsTo
public void setBelongsTo(int belongsTo)
getFatalTag
public java.lang.String getFatalTag()
setFatalTag
public void setFatalTag(java.lang.String fatalTag)
isDeprecated
public boolean isDeprecated()
setDeprecated
public void setDeprecated(boolean deprecated)
isUnique
public boolean isUnique()
setUnique
public void setUnique(boolean unique)
isIgnorePermitted
public boolean isIgnorePermitted()
setIgnorePermitted
public void setIgnorePermitted(boolean ignorePermitted)
Copyright © 2012 Java Wikipedia API (Bliki engine). All Rights Reserved.