to_a (Nokogiri::XML::NodeSet)

    /*
     * call-seq:
     *  to_a
     *
     * Return this list as an Array
     */
    static VALUE to_array(VALUE self, VALUE rb_node)
    {
      xmlNodeSetPtr set;
      Data_Get_Struct(self, xmlNodeSet, set);

      VALUE *elts = calloc((size_t)set->nodeNr, sizeof(VALUE *));
      int i;
      for(i = 0; i < set->nodeNr; i++) {
        if(set->nodeTab[i]->_private) {
          elts[i] = (VALUE)set->nodeTab[i]->_private;
        } else {
          elts[i] = Nokogiri_wrap_xml_node(Qnil, set->nodeTab[i]);
        }
      }

      VALUE list = rb_ary_new4(set->nodeNr, elts);

      free(elts);

      return list;
    }