/* * call-seq: * namespaces() * * returns a hash containing the node's namespaces. */ static VALUE namespaces(VALUE self) { /* this code in the mode of xmlHasProp() */ xmlNodePtr node ; VALUE attr ; attr = rb_hash_new() ; Data_Get_Struct(self, xmlNode, node); Nokogiri_xml_node_namespaces(node, attr); return attr ; }
/* * call-seq: * namespaces * * Get a hash of namespaces for this Node */ static VALUE namespaces(VALUE self) { xmlTextReaderPtr reader; VALUE attr ; Data_Get_Struct(self, xmlTextReader, reader); attr = rb_hash_new() ; if (! has_attributes(reader)) return attr ; xmlNodePtr ptr = xmlTextReaderExpand(reader); if(ptr == NULL) return Qnil; Nokogiri_xml_node_namespaces(ptr, attr); return attr ; }