/* * call-seq: * new(version = default) * * Create a new document with +version+ (defaults to "1.0") */ static VALUE new(int argc, VALUE *argv, VALUE klass) { VALUE version, rest, rb_doc ; rb_scan_args(argc, argv, "0*", &rest); version = rb_ary_entry(rest, 0); if (version == Qnil) { version = rb_str_new2("1.0"); } xmlDocPtr doc = xmlNewDoc((xmlChar *)StringValuePtr(version)); rb_doc = Nokogiri_wrap_xml_document(klass, doc); rb_funcall2(rb_doc, rb_intern("initialize"), argc, argv); return rb_doc ; }