public class LinkTag extends CompositeTag
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
mLink
The URL where the link points to
|
mDefaultCompositeScanner, mEndTag
breakTags, mAttributes, mDefaultScanner
Constructor and Description |
---|
LinkTag()
Constructor creates an LinkTag object, which basically stores the location
where the link points to, and the text it contains.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
extractLink()
Extract the link from the HREF attribute.
|
java.lang.String |
getAccessKey()
Get the
ACCESSKEY attribute, if any. |
java.lang.String[] |
getEnders()
Return the set of tag names that cause this tag to finish.
|
java.lang.String[] |
getEndTagEnders()
Return the set of end tag names that cause this tag to finish.
|
java.lang.String[] |
getIds()
Return the set of names handled by this tag.
|
java.lang.String |
getLink()
Returns the url as a string, to which this link points.
|
java.lang.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
|
SimpleNodeIterator |
linkData()
Deprecated.
Use children() instead.
|
void |
setJavascriptLink(boolean newJavascriptLink)
Set the link as a javascript link.
|
void |
setLink(java.lang.String link)
Set the
HREF attribute. |
void |
setMailLink(boolean newMailLink)
Insert the method's description here.
|
java.lang.String |
toString()
Return the contents of this link node as a string suitable for debugging.
|
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
breaksFlow, getAttribute, getAttributeEx, getAttributes, getAttributesEx, getEndingLineNumber, getParsed, getRawTagName, getStartingLineNumber, getTagBegin, getTagEnd, getTagName, getThisScanner, isEmptyXmlTag, isEndTag, removeAttribute, setAttribute, setAttribute, setAttribute, setAttributeEx, setAttributes, setAttributesEx, setEmptyXmlTag, setTagBegin, setTagEnd, setTagName, setText, setThisScanner
clone, doSemanticAction, getChildren, getEndPosition, getPage, getParent, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
clone, doSemanticAction, getChildren, getEndPosition, getPage, getParent, getStartPosition, setChildren, setEndPosition, setPage, setParent, setStartPosition
public LinkTag()
In order to get the contents of the link tag, use the method linkData(), 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.linkData();e.hasMoreElements();) { node = (Node)e.nextElement(); if (node instanceof ImageTag) { imageTag = (ImageTag)node; // Process imageTag } }
public java.lang.String[] getIds()
public java.lang.String[] getEnders()
public java.lang.String[] getEndTagEnders()
getEndTagEnders
in interface Tag
getEndTagEnders
in class TagNode
public java.lang.String getAccessKey()
ACCESSKEY
attribute, if any.ACCESSKEY
attribute,
or null
if the attribute doesn't exist.public java.lang.String getLink()
true
) but not
for other protocols. Don't ask me why, it's a legacy thing.A
tag.public java.lang.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 java.lang.String toString()
toString
in interface Node
toString
in class CompositeTag
public void setLink(java.lang.String link)
HREF
attribute.link
- The new value of the HREF
attribute.public SimpleNodeIterator linkData()
public java.lang.String extractLink()
HTML Parser is an open source library released under LGPL.