/* * call-seq: * attribute_at(index) * * Get the value of attribute at +index+ */ static VALUE attribute_at(VALUE self, VALUE index) { xmlTextReaderPtr reader; Data_Get_Struct(self, xmlTextReader, reader); if(index == Qnil) return Qnil; index = rb_funcall(index, rb_intern("to_i"), 0); xmlChar * value = xmlTextReaderGetAttributeNo( reader, NUM2INT(index) ); if(value == NULL) return Qnil; VALUE rb_value = rb_str_new2((const char *)value); xmlFree(value); return rb_value; }