GETFIRSTCHILD v18

The GETFIRSTCHILD function retrieves the first child of the particular node. If there's no such node, then this function returns NULL.

GETFIRSTCHILD(n DOMNode) RETURN DOMNode

Parameters

n

The DOMNode whose first child you want to retrieve.

Examples

This example creates a DOMDocument named l_domdoc and turns it into a DOMNode. Then, it creates a DOMElement named l_department_element with the tag name Departments and appends this element as a child to the DOMNode. It then outputs the tag name of the first (and in this example, the only) appended child.

DECLARE
   l_domdoc DBMS_XMLDOM.DOMDocument;
   l_root_node DBMS_XMLDOM.DOMNode;
   l_department_element DBMS_XMLDOM.DOMElement;


BEGIN
   l_domdoc := DBMS_XMLDOM.NEWDOMDOCUMENT();
   l_root_node := DBMS_XMLDOM.MAKENODE(l_domdoc);
   l_department_element := DBMS_XMLDOM.CREATEELEMENT(l_domdoc, 'Departments' );
   PERFORM DBMS_XMLDOM.APPENDCHILD(l_root_node,DBMS_XMLDOM.MAKENODE(l_department_element));
   DBMS_OUTPUT.PUT_LINE(DBMS_XMLDOM.GETNODENAME(DBMS_XMLDOM.GETFIRSTCHILD(l_root_node)));
END;