Module | Nokogiri::Decorators::Hpricot::NodeSet |
In: |
lib/nokogiri/decorators/hpricot/node_set.rb
|
Select nodes matching the supplied rule. Note that positional rules (like :nth()) aren‘t currently supported.
example:
node_set.filter('.ohmy') # selects nodes from the set with class "ohmy" node_set.filter('a#link2') # selects nodes from the set with child node <a id='link2'> node_set.filter('a[@id="link2"]') # selects nodes from the set with child node <a id='link2'>
The complement to filter, select nodes not matching the supplied rule. Note that positional rules (like :nth()) aren‘t currently supported.
See filter for examples.
Also note that you can pass a XML::Node object instead of a rule to remove that object from the node set (if it is present):
node_set.not(node_to_exclude) # selects all nodes EXCEPT node_to_exclude