Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| HTML Parser Home Page
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package org.htmlparser.filters

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

See:
Description

Class Summary
AndFilter | This class accepts all nodes matching both filters (AND operation).
HasAttributeFilter | This class accepts all tags that have a certain attribute, and optionally, with a certain value.
HasChildFilter | This class accepts all tags that have a child acceptable to the filter.
HasParentFilter | This class accepts all tags that have a parent acceptable to the filter.
IsEqualFilter | This class accepts only one specific node.
NodeClassFilter | This class accepts all tags of a given class.
NotFilter | This class accepts all nodes not acceptable to the filter.
OrFilter | This class accepts all nodes matching either filter (OR operation).
StringFilter | This class accepts all string nodes containing the given string.
TagNameFilter | This class accepts all tags matching the tag name.

## 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);

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| © 2004 Somik Raha Mar 14, 2004
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

HTML Parser is an open source library released under LGPL.