Beginner struggling with PHP & XML DOM
Posted: Thu Mar 19, 2009 1:43 pm
Hi
Please forgive me if I am posting to the wrong forum. I am new to PHP and I need help.
I am trying to read this XML file (`myfile.xml`) using DOM:
I created a very simple PHP document I called `xml_01.php`:
When I point my browser to http://localhost/xml_01.php, nothing happens. No errors, nothing. I also specified the full path to my XML data file: no change. I even tried re-install the RPM for PHP&XML : no change.
I know I am doing something wrong: is it the code or my configuration? Can someone please help?
My sandbox config is:
RedHat 2.6.9 el
Apache 2.2.3
PHP 5.16
MySQL 5.0
Thanks.
Al.
Please forgive me if I am posting to the wrong forum. I am new to PHP and I need help.
I am trying to read this XML file (`myfile.xml`) using DOM:
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>Code: Select all
<?php
$xmlDoc = new DOMDocument();
$xmlDoc->load("myfile.xml");
print $xmlDoc->saveXML();
?>I know I am doing something wrong: is it the code or my configuration? Can someone please help?
My sandbox config is:
RedHat 2.6.9 el
Apache 2.2.3
PHP 5.16
MySQL 5.0
Thanks.
Al.