public class HTMLParser
extends java.lang.Object
Middle school students can learn about hurricane science and safety with the Hurricane Strike module, while more advanced students can utilize the multimedia technology of the online meteorology guide Hurricanes.
One of ABC's newest collections, the NASA Scientific Visualization Studio, offers data, images and animations from previous Atlantic storms.
Constructor and Description |
---|
HTMLParser(java.lang.String resourcelocn)
Constructor of an HTMLParser object
|
HTMLParser(java.lang.String htmlcontent,
java.lang.String charset)
Constructor of an HTMLParser object
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getAllLinks()
returns a String array of all the links in the html document.
|
java.lang.String |
getHeaderText()
returns all the text in the html page which is contained within header tags (which includes
|
java.lang.String |
getImgAlts()
returns a String containing all the text within the alt attribute of all the img tags in the html document
|
java.lang.String |
getLinkTitles()
returns a String containing all the text within the title attribute of all the links in the html document
|
java.lang.String |
getMetaTagContentByName(java.lang.String name)
returns the content of the Meta tag whose name equals mname.
|
java.lang.String |
getTitleText()
returns the title of the HTML page , i.e.
|
java.lang.String |
getWholeText()
returns the text of the whole html document, stripped of all the HTML tags.
|
boolean |
hasMetaTagName(java.lang.String name)
returns true if the html document contains a Meta tag with a name equal to mname , otherwise returns false
e.g.
|
public HTMLParser(java.lang.String resourcelocn) throws org.htmlparser.util.ParserException
resourcelocn
- either a URL or the name of an HTML fileorg.htmlparser.util.ParserException
- e.g.:
HTMLParser hp = new HTMLParser("http://www.dlese.org");
HTMLParser hp2 = new HTMLParser(testthis.htm);public HTMLParser(java.lang.String htmlcontent, java.lang.String charset) throws org.htmlparser.util.ParserException
htmlcontent
- String containing the HTML to be parsedcharset
- if null, the default encoding is usedorg.htmlparser.util.ParserException
public java.lang.String getHeaderText() throws org.htmlparser.util.ParserException
org.htmlparser.util.ParserException
public java.lang.String getTitleText() throws org.htmlparser.util.ParserException
org.htmlparser.util.ParserException
public boolean hasMetaTagName(java.lang.String name) throws org.htmlparser.util.ParserException
name
- name of the Meta Tagorg.htmlparser.util.ParserException
public java.lang.String getMetaTagContentByName(java.lang.String name) throws org.htmlparser.util.ParserException
name
- name of the Meta Tagorg.htmlparser.util.ParserException
public java.lang.String[] getAllLinks() throws org.htmlparser.util.ParserException
org.htmlparser.util.ParserException
public java.lang.String getLinkTitles() throws org.htmlparser.util.ParserException
org.htmlparser.util.ParserException
public java.lang.String getImgAlts() throws org.htmlparser.util.ParserException
org.htmlparser.util.ParserException
public java.lang.String getWholeText() throws org.htmlparser.util.ParserException
org.htmlparser.util.ParserException