Method: Nokogiri::XML::Node#child
- Defined in:
- ext/nokogiri/xml_node.c
permalink #child ⇒ Object
:call-seq: child() → Nokogiri::XML::Node
:category: Traversing Document Structure
- Returns
-
First of this node’s children, or
nil
if there are no children
This is a convenience method and is equivalent to:
node.children.first
See related: #children
688 689 690 691 692 693 694 695 696 697 698 |
# File 'ext/nokogiri/xml_node.c', line 688
static VALUE
rb_xml_node_child(VALUE self)
{
xmlNodePtr node, child;
Noko_Node_Get_Struct(self, xmlNode, node);
child = node->children;
if (!child) { return Qnil; }
return noko_xml_node_wrap(Qnil, child);
}
|