<?php
$first_name = "Karl Angelo Tanjuan;"
$dom = new DOMDocument();
$dom->load('xml/sample.xml');
$dom->formatOutput = true;
$root = $dom->documentElement;
// clear the existing text content
$dom->getElementsByTagName("FirstName")->item(0)->nodeValue = "";
// then create new text node
$dom->getElementsByTagName("FirstName")->item(0)->appendChild($dom->createTextNode($first_name));
$dom->save('xml/sample.xml');
?>
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.