it.sauronsoftware.grab4j.html
Class HTMLTag

java.lang.Object
  extended by it.sauronsoftware.grab4j.html.HTMLElement
      extended by it.sauronsoftware.grab4j.html.HTMLTag
Direct Known Subclasses:
HTMLImage, HTMLLink

public class HTMLTag
extends HTMLElement

This class represents the HTML tags.

Author:
Carlo Pelliccia

Method Summary
 java.lang.String getAttribute(java.lang.String attributeName)
          This method returns the value of an attribute of the tag.
 java.lang.String getInnerHTML()
          This method returns the HTML code in the tag contents.
 java.lang.String getInnerText()
          This method extracts a plain text from the tag contents.
 java.lang.String getOuterHTML()
          This method returns the HTML code with the tag and its contents.
 java.lang.String getTagName()
          This method returns the tag name.
 boolean isEmpty()
          This method tests if the tag has a content.
 java.lang.String toString()
           
 
Methods inherited from class it.sauronsoftware.grab4j.html.HTMLElement
getDocument, getElement, getElementById, getElementCount, getElements, getElementsByAttribute, getElementsByTag, getNextElement, getParentElement, getPreviousElement, searchElement, searchElement, searchElements, searchElements
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getAttribute

public java.lang.String getAttribute(java.lang.String attributeName)
This method returns the value of an attribute of the tag.

Parameters:
attributeName - The attribute name.
Returns:
The attribute value, or null if the tag doesn't have the suggested attribute.

getTagName

public java.lang.String getTagName()
This method returns the tag name.

Returns:
The tag name.

isEmpty

public boolean isEmpty()
This method tests if the tag has a content.

Returns:
true if the tag is empty.

getOuterHTML

public java.lang.String getOuterHTML()
This method returns the HTML code with the tag and its contents.

Returns:
The HTML code of the tag and its contents.

getInnerHTML

public java.lang.String getInnerHTML()
This method returns the HTML code in the tag contents.

Returns:
The HTML code in the tag contents.

getInnerText

public java.lang.String getInnerText()
This method extracts a plain text from the tag contents.

Returns:
A plain text representation of the tag contents.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object