Method: Nokogiri::XML::NodeSet#dup

Defined in:
ext/nokogiri/xml_node_set.c

#dupObject Also known as: clone

Duplicate this NodeSet. Note that the Nodes contained in the NodeSet are not duplicated (similar to how Array and other Enumerable classes work).



123
124
125
126
127
128
129
130
131
132
133
134
# File 'ext/nokogiri/xml_node_set.c', line 123

static VALUE
duplicate(VALUE rb_self)
{
  xmlNodeSetPtr c_self;
  xmlNodeSetPtr dupl;

  TypedData_Get_Struct(rb_self, xmlNodeSet, &xml_node_set_type, c_self);

  dupl = xmlXPathNodeSetMerge(NULL, c_self);

  return noko_xml_node_set_wrap(dupl, rb_iv_get(rb_self, "@document"));
}