/*
* call-seq:
* children
*
* Get the list of children for this node as a NodeSet
*/
static VALUE children(VALUE self)
{
xmlNodePtr node;
Data_Get_Struct(self, xmlNode, node);
xmlNodePtr child = node->children;
xmlNodeSetPtr set = xmlXPathNodeSetCreate(child);
if(!child) return Nokogiri_wrap_xml_node_set(set);
child = child->next;
while(NULL != child) {
xmlXPathNodeSetAdd(set, child);
child = child->next;
}
VALUE node_set = Nokogiri_wrap_xml_node_set(set);
rb_iv_set(node_set, "@document", DOC_RUBY_OBJECT(node->doc));
return node_set;
}