HTML Parser Home Page

Package org.htmlparser.filters

The filters package contains example filters to select only desired nodes.

See: Description

Package org.htmlparser.filters Description

The filters package contains example filters to select only desired nodes. For example, to display tags having the "id" attribute, you could use:
Parser parser = new Parser ("http://yadda");
parser.parse (new HasAttributeFilter ("id"));
These filters can be combined to yield powerful extraction capabilities. For example, to get a list of links where the contents is an image, you could use:
NodeList list = new NodeList ();
NodeFilter filter =
    new AndFilter (
        new TagNameFilter ("A"),
        new HasChildFilter (
            new TagNameFilter ("IMG")));
for (NodeIterator e = parser.elements (); e.hasMoreNodes (); )
    e.nextNode ().collectInto (list, filter);
© 2005 Derrick Oswald
Nov 18, 2014

HTML Parser is an open source library released under LGPL. SourceForge.net