Method: Nokogiri::XML::NodeSet#unlink
- Defined in:
- ext/nokogiri/xml_node_set.c
#unlink ⇒ Object Also known as: remove
Unlink this NodeSet and all Node objects it contains from their current context.
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'ext/nokogiri/xml_node_set.c', line 426
static VALUE
unlink_nodeset(VALUE rb_self)
{
xmlNodeSetPtr c_self;
int j, nodeNr ;
TypedData_Get_Struct(rb_self, xmlNodeSet, &xml_node_set_type, c_self);
nodeNr = c_self->nodeNr ;
for (j = 0 ; j < nodeNr ; j++) {
if (! NOKOGIRI_NAMESPACE_EH(c_self->nodeTab[j])) {
VALUE node ;
xmlNodePtr node_ptr;
node = noko_xml_node_wrap(Qnil, c_self->nodeTab[j]);
rb_funcall(node, rb_intern("unlink"), 0); /* modifies the C struct out from under the object */
Noko_Node_Get_Struct(node, xmlNode, node_ptr);
c_self->nodeTab[j] = node_ptr ;
}
}
return rb_self ;
}
|