< /article>
*/
if(!function_exists('l')) {
function l() {
echo '
************************ ******************
';
}
}
if(file_exists('test10_12.xml')) {
$xml = simplexml_load_file(' test10_12.xml');
//Use the xpath method to find the node location
$query = $xml->xpath('//title[@name="t1"]/ancestor::item');
var_dump($ query);
l();
//Test new sub-node under title node new
$query[0]->title->addChild('new','new');
//Test under Add attribute fuck under the title node
$query[0]->title->addAttribute('fuck','fuck you');
//Test and modify the content node value to hello,world
$query[0] ->content = 'hello,world';
//No explanation, you know
$query[0]->asXML("10.xml");
}
?>