/* * call-seq: * &(node_set) * * Set Intersection — Returns a new NodeSet containing nodes common to the two NodeSets. */ static VALUE intersection(VALUE self, VALUE rb_other) { xmlNodeSetPtr node_set; xmlNodeSetPtr other; if(! rb_funcall(rb_other, rb_intern("is_a?"), 1, cNokogiriXmlNodeSet)) rb_raise(rb_eArgError, "node_set must be a Nokogiri::XML::NodeSet"); Data_Get_Struct(self, xmlNodeSet, node_set); Data_Get_Struct(rb_other, xmlNodeSet, other); return Nokogiri_wrap_xml_node_set(xmlXPathIntersection(node_set, other)); }