HTML Parser Home Page

org.htmlparser.tags
Class ImageTag

java.lang.Object
  extended byorg.htmlparser.AbstractNode
      extended byorg.htmlparser.lexer.nodes.TagNode
          extended byorg.htmlparser.tags.Tag
              extended byorg.htmlparser.tags.ImageTag
All Implemented Interfaces:
Cloneable, Node, Serializable

public class ImageTag
extends Tag

Identifies an image tag.

See Also:
Serialized Form

Field Summary
protected  String imageURL
          Holds the set value of the SRC attribute, since this can differ from the attribute value due to relative references resolved by the scanner.
 
Fields inherited from class org.htmlparser.tags.Tag
mDefaultScanner
 
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
ImageTag()
          Create a new image tag.
 
Method Summary
 void accept(NodeVisitor visitor)
          Image visiting code.
 String extractImageLocn()
          Extract the location of the image Given the tag (with attributes), and the url of the html page in which this tag exists, perform best effort to extract the 'intended' URL.
 String[] getIds()
          Return the set of names handled by this tag.
 String getImageURL()
          Returns the location of the image
 void setImageURL(String url)
           
 
Methods inherited from class org.htmlparser.tags.Tag
accept, clone, getEnders, getEndTagEnders, getThisScanner, setThisScanner
 
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

imageURL

protected String imageURL
Holds the set value of the SRC attribute, since this can differ from the attribute value due to relative references resolved by the scanner.

Constructor Detail

ImageTag

public ImageTag()
Create a new image tag.

Method Detail

getIds

public String[] getIds()
Return the set of names handled by this tag.

Overrides:
getIds in class Tag
Returns:
The names to be matched that create tags of this type.

extractImageLocn

public String extractImageLocn()
Extract the location of the image Given the tag (with attributes), and the url of the html page in which this tag exists, perform best effort to extract the 'intended' URL. Attempts to handle such attributes as:
 <IMG SRC=http://www.redgreen.com> - normal
 <IMG SRC =http://www.redgreen.com> - space between attribute name and equals sign
 <IMG SRC= http://www.redgreen.com> - space between equals sign and attribute value
 <IMG SRC = http://www.redgreen.com> - space both sides of equals sign
 


getImageURL

public String getImageURL()
Returns the location of the image


setImageURL

public void setImageURL(String url)

accept

public void accept(NodeVisitor visitor)
Image visiting code. Invokes visitImageTag() on the visitor and then invokes the normal tag processing.

Overrides:
accept in class Tag
Parameters:
visitor - The NodeVisitor object to invoke visitImageTag() on.

© 2004 Somik Raha
Mar 14, 2004

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