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

      Data_Get_Struct(self, xmlNodeSet, set);

      elts = calloc((size_t)set->nodeNr, sizeof(VALUE *));
      for(i = 0; i < set->nodeNr; i++) {
        if (XML_NAMESPACE_DECL == set->nodeTab[i]->type) {
          elts[i] = Nokogiri_wrap_xml_namespace2(rb_iv_get(self, "@document"), (xmlNsPtr)(set->nodeTab[i]));
        } else {
          xmlNodePtr node = set->nodeTab[i];

          if(node->_private) {
            if(node->type == XML_DOCUMENT_NODE || node->type == XML_HTML_DOCUMENT_NODE)
              elts[i] = DOC_RUBY_OBJECT(node->doc);
            else
              elts[i] = (VALUE)node->_private;
          } else {
            elts[i] = Nokogiri_wrap_xml_node(Qnil, node);
          }
        }
      }

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

      /*free(elts); */

      return list;
    }