/* * call-seq: * add_next_sibling(node) * * Insert +node+ after this node (as a sibling). */ static VALUE add_next_sibling(VALUE self, VALUE rb_node) { xmlNodePtr node, _new_sibling, new_sibling; Data_Get_Struct(self, xmlNode, node); Data_Get_Struct(rb_node, xmlNode, _new_sibling); if(!(new_sibling = xmlAddNextSibling(node, _new_sibling))) rb_raise(rb_eRuntimeError, "Could not add next sibling"); // the sibling was a text node that was coalesced. we need to have the object // point at SOMETHING, or we'll totally bomb out. if(new_sibling != _new_sibling) DATA_PTR(rb_node) = new_sibling; rb_funcall(rb_node, rb_intern("decorate!"), 0); return rb_node; }