util
Class HTMLParser
java.lang.Object
|
+--util.HTMLParser
- public class HTMLParser
- extends Object
HTMLParser
is a utility to work with HTML files.
You can parse through all the elements of a specific tag (such as
all HTML.Tag.DIV), or all elements with a specific attribute (such
as HTML.Attribute.CLASS), etc.
- See Also:
util.HTMLElement()
Constructor Summary |
HTMLParser(URL uFile)
Creates a new HTMLParser instance. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
HTMLParser
public HTMLParser(URL uFile)
throws MalformedURLException
- Creates a new
HTMLParser
instance.
- Parameters:
uFile
- an URL
value- Throws:
- MalformedURLException - if an error occurs
get
public Vector get(HTML.Tag hTag)
- Gets all the elements of a specific tag. Returns a Vector of
matching HTMLElements.
For example, get(HTML.Tag.P) returns a Vector of HTMLElements, where
each HTMLElement represents an existing P element in the document.
- Parameters:
hTag
- a HTML.Tag
value- Returns:
- a
Vector
value - See Also:
util.HTMLElements
get
public Vector get(HTML.Attribute hAttribute)
- Gets all the elements with a specific attribute. Returns a Vector of
matching HTMLElements.
For example, get(HTML.Attribute.CLASS) returns a Vector of HTMLElements,
where each HTMLElement represents an element with the "class=" attribute
set.
- Parameters:
hAttribute
- a HTML.Attribute
value- Returns:
- a
Vector
value - See Also:
util.HTMLElements
get
public Vector get(HTML.Attribute hAttribute,
String sAttributeValue)
- Gets all the elements with a specific attribute that matches the
specified value. Returns a Vector of matching HTMLElements.
For example, get(HTML.Attribute.CLASS, "foo") returns a Vector of
HTMLElements, where each HTMLElement represents an element with
the "class=foo" attribute set
- Parameters:
hAttribute
- a HTML.Attribute
valuesAttributeValue
- a String
value- Returns:
- a
Vector
value - See Also:
util.HTMLElements
get
public Vector get(HTML.Tag hTag,
HTML.Attribute hAttribute,
String sAttributeValue)
- Gets all the elements of a specific tag with a specific attribute that
matches the specified value. Returns a Vector of matching HTMLElements.
For example, get(HTML.Tag.DIV, HTML.Attribute.CLASS, "foo") returns a
Vector of HTMLElements, where each HTMLElement represents a DIV element
with the "class=foo" attribute set
- Parameters:
hTag
- a HTML.Tag
valuehAttribute
- a HTML.Attribute
valuesAttributeValue
- a String
value- Returns:
- a
Vector
value - See Also:
util.HTMLElements