DOM in PHP: Decoded entities and setting nodeValue
问题 I want to perform certain manipulations on a XML document with PHP using the DOM part of its standard library. As others have already discovered, one has to deal with decoded entities then. To illustrate what bothers me, I give a quick example. Suppose we have the following code $doc = new DOMDocument(); $doc->loadXML(<XML data>); $xpath = new DOMXPath($doc); $node_list = $xpath->query(<some XPath>); foreach($node_list as $node) { //do something } If the code in the loop is something like