/* * call-seq: * new(document, content) * * Create a new Attr element on the +document+ with +name+ */ static VALUE new(VALUE klass, VALUE doc, VALUE name) { xmlDocPtr xml_doc; Data_Get_Struct(doc, xmlDoc, xml_doc); xmlAttrPtr node = xmlNewDocProp( xml_doc, (const xmlChar *)StringValuePtr(name), NULL ); VALUE rb_node = Nokogiri_wrap_xml_node((xmlNodePtr)node); if(rb_block_given_p()) rb_yield(rb_node); return rb_node; }