Class Nokogiri::XML::NodeSet
In: lib/nokogiri/ffi/xml/node_set.rb
lib/nokogiri/xml/node_set.rb
Parent: Object

A NodeSet contains a list of Nokogiri::XML::Node objects. Typically a NodeSet is return as a result of searching a Document via Nokogiri::XML::Node#css or Nokogiri::XML::Node#xpath

Methods

%   /   ==   add_class   after   at   attr   attribute   before   children   css   each   empty?   filter   first   index   inner_html   inner_text   inspect   last   new   pop   remove_attr   remove_class   reverse   search   set   shift   text   to_html   to_s   to_xhtml   to_xml   wrap   xpath  

Included Modules

Enumerable

External Aliases

[] -> slice
push -> <<
unlink -> remove
length -> size
to_a -> to_ary
| -> +

Attributes

document  [RW]  The Document this NodeSet is associated with

Public Class methods

Create a NodeSet with document defaulting to list

Public Instance methods

%(path, ns = document.root ? document.root.namespaces : {})

Alias for at

/(*paths)

Alias for search

Equality — Two NodeSets are equal if the contain the same number of elements and if each element is equal to the corresponding element in the other NodeSet

Append the class attribute name to all Node objects in the NodeSet.

Insert datum after the last Node in this NodeSet

If path is a string, search this document for path returning the first Node. Otherwise, index in to the array with path.

Set the attribute key to value or the return value of blk on all Node objects in the NodeSet.

attribute(key, value = nil, &blk)

Alias for attr

Insert datum before the first Node in this NodeSet

Returns a new NodeSet containing all the children of all the nodes in the NodeSet

Search this NodeSet for css paths

For more information see Nokogiri::XML::Node#css

Iterate over each node, yielding to block

Is this NodeSet empty?

Filter this list for nodes that match expr

Get the first element of the NodeSet.

Returns the index of the first node in self that is == to node. Returns nil if no match is found.

Get the inner html of all contained Node objects

Get the inner text of all contained Node objects

Return a nicely formated string representation

Get the last element of the NodeSet.

Removes the last element from set and returns it, or nil if the set is empty

Remove the attributed named name from all Node objects in the NodeSet

Remove the class attribute name from all Node objects in the NodeSet. If name is nil, remove the class attribute from all Nodes in the NodeSet.

Returns a new NodeSet containing all the nodes in the NodeSet in reverse order

Search this document for paths

For more information see Nokogiri::XML::Node#css and Nokogiri::XML::Node#xpath

set(key, value = nil, &blk)

Alias for attr

Returns the first element of the NodeSet and removes it. Returns nil if the set is empty.

text()

Alias for inner_text

Convert this NodeSet to HTML

Convert this NodeSet to a string.

Convert this NodeSet to XHTML

Convert this NodeSet to XML

Wrap this NodeSet with html or the results of the builder in blk

Search this NodeSet for XPath paths

For more information see Nokogiri::XML::Node#xpath

[Validate]