Package org.htmlparser.tags
Class ImageTag
java.lang.Object
org.htmlparser.nodes.AbstractNode
org.htmlparser.nodes.TagNode
org.htmlparser.tags.ImageTag
- All Implemented Interfaces:
Serializable,Cloneable,Node,Tag
Identifies an image tag.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringHolds 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.nodes.TagNode
breakTags, mAttributes, mDefaultScanner -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionExtract 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.Returns the location of the image.voidsetImageURL(String url) Set theSRCattribute.Methods inherited from class org.htmlparser.nodes.TagNode
accept, breaksFlow, getAttribute, getAttributeEx, getAttributesEx, getEnders, getEndingLineNumber, getEndTag, getEndTagEnders, getRawTagName, getStartingLineNumber, getTagBegin, getTagEnd, getTagName, getText, getThisScanner, isEmptyXmlTag, isEndTag, removeAttribute, setAttribute, setAttribute, setAttribute, setAttributeEx, setAttributesEx, setEmptyXmlTag, setEndTag, setTagBegin, setTagEnd, setTagName, setText, setThisScanner, toHtml, toPlainTextString, toStringMethods inherited from class org.htmlparser.nodes.AbstractNode
clone, collectInto, doSemanticAction, getChildren, getEndPosition, getFirstChild, getLastChild, getNextSibling, getPage, getParent, getPreviousSibling, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition, toHtmlMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.htmlparser.Node
clone, collectInto, doSemanticAction, getChildren, getEndPosition, getFirstChild, getLastChild, getNextSibling, getPage, getParent, getPreviousSibling, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition, toHtml
-
Field Details
-
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 Details
-
ImageTag
public ImageTag()Create a new image tag.
-
-
Method Details
-
getIds
Return the set of names handled by this tag. -
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
- Returns:
- The relative URL for the image.
-
getImageURL
Returns the location of the image.- Returns:
- The absolute URL for this image.
-
setImageURL
Set theSRCattribute.- Parameters:
url- The new value of theSRCattribute.
-