|
HTML Parser Home Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.htmlparser.nodes.AbstractNode org.htmlparser.nodes.TagNode org.htmlparser.tags.CompositeTag org.htmlparser.tags.LinkTag
public class LinkTag
Identifies a link tag.
Field Summary | |
---|---|
protected String |
mLink
The URL where the link points to |
Fields inherited from class org.htmlparser.tags.CompositeTag |
---|
mDefaultCompositeScanner, mEndTag |
Fields inherited from class org.htmlparser.nodes.TagNode |
---|
breakTags, mAttributes, mDefaultScanner |
Fields inherited from class org.htmlparser.nodes.AbstractNode |
---|
children, mPage, nodeBegin, nodeEnd, parent |
Constructor Summary | |
---|---|
LinkTag()
Constructor creates an LinkTag object, which basically stores the location where the link points to, and the text it contains. |
Method Summary | |
---|---|
String |
extractLink()
Extract the link from the HREF attribute. |
String |
getAccessKey()
Get the ACCESSKEY attribute, if any. |
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. |
String |
getLink()
Returns the url as a string, to which this link points. |
String |
getLinkText()
Returns the text contained inside this link tag. |
boolean |
isFTPLink()
Tests if the link is an FTP link. |
boolean |
isHTTPLikeLink()
Tests if the link is an HTTP link or one of its variations (HTTPS, etc.). |
boolean |
isHTTPLink()
Tests if the link is an HTTP link. |
boolean |
isHTTPSLink()
Tests if the link is an HTTPS link. |
boolean |
isIRCLink()
Tests if the link is an IRC link. |
boolean |
isJavascriptLink()
Tests if the link is javascript |
boolean |
isMailLink()
Is this a mail address |
void |
setJavascriptLink(boolean newJavascriptLink)
Set the link as a javascript link. |
void |
setLink(String link)
Set the HREF attribute. |
void |
setMailLink(boolean newMailLink)
Insert the method's description here. |
String |
toString()
Return the contents of this link node as a string suitable for debugging. |
Methods inherited from class org.htmlparser.tags.CompositeTag |
---|
accept, childAt, children, collectInto, digupStringNode, elements, findPositionOf, findPositionOf, findPositionOf, getChild, getChildCount, getChildrenAsNodeArray, getChildrenHTML, getEndTag, getStringText, getText, putChildrenInto, putEndTagInto, removeChild, searchByName, searchFor, searchFor, searchFor, searchFor, setEndTag, toHtml, toPlainTextString, toString |
Methods inherited from class org.htmlparser.nodes.TagNode |
---|
breaksFlow, getAttribute, getAttributeEx, getAttributesEx, getEndingLineNumber, getRawTagName, getStartingLineNumber, getTagBegin, getTagEnd, getTagName, getThisScanner, isEmptyXmlTag, isEndTag, removeAttribute, setAttribute, setAttribute, setAttribute, setAttributeEx, setAttributesEx, setEmptyXmlTag, setTagBegin, setTagEnd, setTagName, setText, setThisScanner |
Methods inherited from class org.htmlparser.nodes.AbstractNode |
---|
clone, doSemanticAction, getChildren, getEndPosition, getFirstChild, getLastChild, getNextSibling, getPage, getParent, getPreviousSibling, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition, toHtml |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.htmlparser.Node |
---|
clone, doSemanticAction, getChildren, getEndPosition, getFirstChild, getLastChild, getNextSibling, getPage, getParent, getPreviousSibling, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition, toHtml |
Field Detail |
---|
protected String mLink
Constructor Detail |
---|
public LinkTag()
In order to get the contents of the link tag, use the method children(), which returns an enumeration of nodes encapsulated within the link.
The following code will get all the images inside a link tag.
Node node ; ImageTag imageTag; for (Enumeration e=linkTag.children();e.hasMoreElements();) { node = (Node)e.nextElement(); if (node instanceof ImageTag) { imageTag = (ImageTag)node; // Process imageTag } }
Method Detail |
---|
public String[] getIds()
getIds
in interface Tag
getIds
in class TagNode
public String[] getEnders()
getEnders
in interface Tag
getEnders
in class TagNode
public String[] getEndTagEnders()
getEndTagEnders
in interface Tag
getEndTagEnders
in class TagNode
public String getAccessKey()
ACCESSKEY
attribute, if any.
ACCESSKEY
attribute,
or null
if the attribute doesn't exist.public String getLink()
true
) but not
for other protocols. Don't ask me why, it's a legacy thing.
A
tag.public String getLinkText()
public boolean isMailLink()
public boolean isJavascriptLink()
public boolean isFTPLink()
public boolean isIRCLink()
public boolean isHTTPLink()
public boolean isHTTPSLink()
public boolean isHTTPLikeLink()
public void setMailLink(boolean newMailLink)
newMailLink
- booleanpublic void setJavascriptLink(boolean newJavascriptLink)
newJavascriptLink
- flag indicating if the link is a javascript codepublic String toString()
toString
in interface Node
toString
in class CompositeTag
public void setLink(String link)
HREF
attribute.
link
- The new value of the HREF
attribute.public String extractLink()
|
© 2006 Derrick Oswald Sep 17, 2006
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
HTML Parser is an open source library released under Common Public License. |