PHP5: Find Root Node in DOMDocument
DOM Model- The W3C has broken down the DOM into a tree structure of nodes of varying types. The Node interface is the base interface for all elements. All objects implementing this interface expose methods for dealing with children.
$dom=new DomDocument;$dom->Load("file.xml");$root=$dom->documentElement; // Root node
According to the PHP docs DOMElement is a subclass of DOMNode, so it should inherit the hasChildNodes()
-method.