HTML Parser Home Page

org.htmlparser.tags
Class Tag

java.lang.Object
  extended byorg.htmlparser.AbstractNode
      extended byorg.htmlparser.lexer.nodes.TagNode
          extended byorg.htmlparser.tags.Tag
All Implemented Interfaces:
Cloneable, Node, Serializable
Direct Known Subclasses:
BaseHrefTag, CompositeTag, DoctypeTag, FrameTag, ImageTag, InputTag, JspTag, MetaTag

public class Tag
extends TagNode
implements Cloneable

Tag represents a generic tag. If no scanner is registered for a given tag name, this is what you get. This is also the base class for all tags created by the parser (not the lexer which has nodes).

See Also:
Serialized Form

Field Summary
protected static TagScanner mDefaultScanner
          The default scanner for non-composite tags.
 
Fields inherited from class org.htmlparser.lexer.nodes.TagNode
breakTags, mAttributes
 
Fields inherited from class org.htmlparser.AbstractNode
children, mPage, nodeBegin, nodeEnd, parent
 
Constructor Summary
Tag()
           
Tag(Page page, int start, int end, Vector attributes)
           
Tag(TagNode node, TagScanner scanner)
           
 
Method Summary
 void accept(NodeVisitor visitor)
          Default tag visiting code.
 void accept(Object visitor)
          Handle a visitor.
 Object clone()
           
 String[] getEnders()
          Return the set of tag names that cause this tag to finish.
 String[] getEndTagEnders()
          Return the set of end tag names that cause this tag to finish.
 String[] getIds()
          Return the set of names handled by this tag.
 TagScanner getThisScanner()
          Return the scanner associated with this tag.
 void setThisScanner(TagScanner scanner)
           
 
Methods inherited from class org.htmlparser.lexer.nodes.TagNode
breaksFlow, getAttribute, getAttributeEx, getAttributes, getAttributesEx, getEndingLineNumber, getParameter, getParsed, getRawTagName, getStartingLineNumber, getTagBegin, getTagEnd, getTagName, getText, isEmptyXmlTag, isEndTag, removeAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributesEx, setEmptyXmlTag, setTagBegin, setTagEnd, setTagName, setText, toHtml, toPlainTextString, toString
 
Methods inherited from class org.htmlparser.AbstractNode
collectInto, doSemanticAction, elementBegin, elementEnd, getChildren, getEndPosition, getPage, getParent, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition, toHTML
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mDefaultScanner

protected static final TagScanner mDefaultScanner
The default scanner for non-composite tags.

Constructor Detail

Tag

public Tag()

Tag

public Tag(TagNode node,
           TagScanner scanner)

Tag

public Tag(Page page,
           int start,
           int end,
           Vector attributes)
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Throws:
CloneNotSupportedException

getIds

public String[] getIds()
Return the set of names handled by this tag. Since this a a generic tag, it has no ids.

Returns:
The names to be matched that create tags of this type.

getEnders

public String[] getEnders()
Return the set of tag names that cause this tag to finish. These are the normal (non end tags) that if encountered while scanning (a composite tag) will cause the generation of a virtual tag. Since this a a non-composite tag, the default is no enders.

Returns:
The names of following tags that stop further scanning.

getEndTagEnders

public String[] getEndTagEnders()
Return the set of end tag names that cause this tag to finish. These are the end tags that if encountered while scanning (a composite tag) will cause the generation of a virtual tag. Since this a a non-composite tag, it has no end tag enders.

Returns:
The names of following end tags that stop further scanning.

getThisScanner

public TagScanner getThisScanner()
Return the scanner associated with this tag.


setThisScanner

public void setThisScanner(TagScanner scanner)

accept

public void accept(Object visitor)
Handle a visitor. NOTE: This currently defers to accept(NodeVisitor). If subclasses of Node override accept(Object) directly, they must handle the delegation to visitTag() and visitEndTag().

Specified by:
accept in interface Node
Overrides:
accept in class TagNode
Parameters:
visitor - The NodeVisitor object (a cast is performed without checking).

accept

public void accept(NodeVisitor visitor)
Default tag visiting code. Based on isEndTag(), calls either visitTag() or visitEndTag().


© 2004 Somik Raha
Mar 14, 2004

HTML Parser is an open source library released under LGPL.
SourceForge.net