How can the XPath query be adjusted to retrieve all subnodes of a specific node in PHP?

To retrieve all subnodes of a specific node in PHP using XPath, you can modify the XPath query to select all descendant nodes of the specific node. This can be achieved by using a double forward slash '//' before the node name in the XPath query. This will select all nodes that are descendants of the specified node, regardless of their depth in the XML structure.

// Load the XML file
$xml = new DOMDocument();
$xml->load('file.xml');

// Create a new XPath query to select all subnodes of a specific node
$xpath = new DOMXPath($xml);
$node = $xpath->query("//specificNode//*");

// Loop through the selected nodes and do something with them
foreach ($node as $subnode) {
    // Do something with the subnode
    echo $subnode->nodeValue . "\n";
}