Location: PHPKode > scripts > xml2tree > xml2tree/readWrite.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
 <HEAD>
  <TITLE>Test Page for xml2tree</TITLE>
 </HEAD>
  <H1 ALIGN="CENTER">
     Reading and writing XML with xml2tree...
  </H1>

  <?

  // include the file with all the functions and classes
  require ("xml2tree.inc");



$xmlFile = "display.xml";

// read the XML file and store it as an object
$topNode = readXML ($xmlFile);

// insert today's date as first child
$topNode->insertChildText(date("l dS of F Y h:i:s A"), 0);


// write the xml to browser display
$topNode->printHTML();

echo "<hr>\n------ printing out the XML object to Page Source  ----<br>\n";
$topNode->printEcho();


// write the xml to a file
writeXML("foo.xml", $topNode);

           ?>


 </BODY>
</HTML>



Return current item: xml2tree