DomXPath php省略html元素[重复]

This question already has an answer here:

I'm trying to keep certain parts of HTML elements inside a dom that was loaded by DomDocument and CURL.

Problem is that when I do xpath query and retireve nodeValue it omits the HTML elements.

Below is the code. Is there a way to retrieve HTML for that particular node?

$location = $xpath->query("//div[@id='location']/label");
echo $location->item(0)->nodeValue."<br>";
</div>
$dom = new DOMDocument();
$dom->loadHTML('<html><div id="location"><label><h1>Hello <b>world</b></h1></label></div></html>');
$xpath = new DOMXPath($dom);
$location = $xpath->query("//div[@id='location']/label/*");


var_dump($dom->saveXML($location->item(0)));

Output:

string(27) "<h1>Hello <b>world</b></h1>"