Class CssSelectorNodeFilter

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, NodeFilter

    public class CssSelectorNodeFilter
    extends java.lang.Object
    implements NodeFilter
    A NodeFilter that accepts nodes based on whether they match a CSS2 selector. Refer to http://www.w3.org/TR/REC-CSS2/selector.html for syntax.

    Todo: more thorough testing, any relevant pseudo-classes, css3 features

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CssSelectorNodeFilter​(java.lang.String selector)
      Create a Cascading Style Sheet node filter.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(Node node)
      Accept nodes that match the selector expression.
      static java.lang.String unescape​(java.lang.String escaped)
      Replace escape sequences in a string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CssSelectorNodeFilter

        public CssSelectorNodeFilter​(java.lang.String selector)
        Create a Cascading Style Sheet node filter.
        Parameters:
        selector - The selector expression.
    • Method Detail

      • accept

        public boolean accept​(Node node)
        Accept nodes that match the selector expression.
        Specified by:
        accept in interface NodeFilter
        Parameters:
        node - The node to check.
        Returns:
        true if the node matches, false otherwise.
      • unescape

        public static java.lang.String unescape​(java.lang.String escaped)
        Replace escape sequences in a string.
        Parameters:
        escaped - The string to examine.
        Returns:
        The argument with escape sequences replaced by their equivalent character.