/*
* call-seq:
* new_from_str(string)
*
* Create a new node by parsing +string+
*/
static VALUE new_from_str(VALUE klass, VALUE xml)
{
/*
* I couldn't find a more efficient way to do this. So we create a new
* document and copy (recursively) the root node.
*/
VALUE rb_doc ;
xmlDocPtr doc ;
xmlNodePtr node ;
rb_doc = rb_funcall(cNokogiriXmlDocument, rb_intern("read_memory"), 4,
xml, Qnil, Qnil, INT2NUM(0));
Data_Get_Struct(rb_doc, xmlDoc, doc);
node = xmlCopyNode(xmlDocGetRootElement(doc), 1); /* 1 => recursive */
node->doc = doc;
return Nokogiri_wrap_xml_node(node);
}