/* * call-seq: * attribute_nodes * * Get a list of attributes for this Node */ static VALUE attribute_nodes(VALUE self) { xmlTextReaderPtr reader; VALUE attr ; Data_Get_Struct(self, xmlTextReader, reader); attr = rb_ary_new() ; if (! has_attributes(reader)) return attr ; xmlNodePtr ptr = xmlTextReaderExpand(reader); if(ptr == NULL) return Qnil; VALUE enc = rb_iv_get(self, "@encoding"); if(enc != Qnil && NULL == ptr->doc->encoding) { ptr->doc->encoding = calloc((size_t)RSTRING_LEN(enc), sizeof(char)); strncpy( (char *)ptr->doc->encoding, StringValuePtr(enc), (size_t)RSTRING_LEN(enc) ); } Nokogiri_xml_node_properties(ptr, attr); return attr ; }