XML DOM
Posted: Wed May 07, 2008 10:36 am
Hi,
I was hoping someone could help me out on a little XML DOM I am having a bit of trouble with.
On my local machine, loading and saving XML files is a piece of cake, but when i upload to the server and try the same code, there are no results.
Here is the code that I am using at the moment:
$document='slideshow.xml';
$dom=new DOMDocument;
$dom->load($document);
$dom->formatOutput = true;
$file = ($_FILES['file']['name']);
echo $file;
$albums=$dom->getElementsByTagName('album');
foreach($albums as $album){
$item = $dom->createElement("img");
$album->appendChild($item);
$src = $dom->createAttribute("src");
$item->appendChild($src);
$thumbnail = $dom->createAttribute("thumbnail");
$item->appendChild($thumbnail);
$file2 = $dom->createTextNode($file);
$src->appendChild($file2);
$file = $dom->createTextNode($file);
$thumbnail->appendChild($file);
}
$dom->save($document);
I have tried many different threads and also the paths for the xml file, which is located in the same folder as this code.
Is there something that I am missing that will not load the file?
Thanks in advance,
Pat
I was hoping someone could help me out on a little XML DOM I am having a bit of trouble with.
On my local machine, loading and saving XML files is a piece of cake, but when i upload to the server and try the same code, there are no results.
Here is the code that I am using at the moment:
$document='slideshow.xml';
$dom=new DOMDocument;
$dom->load($document);
$dom->formatOutput = true;
$file = ($_FILES['file']['name']);
echo $file;
$albums=$dom->getElementsByTagName('album');
foreach($albums as $album){
$item = $dom->createElement("img");
$album->appendChild($item);
$src = $dom->createAttribute("src");
$item->appendChild($src);
$thumbnail = $dom->createAttribute("thumbnail");
$item->appendChild($thumbnail);
$file2 = $dom->createTextNode($file);
$src->appendChild($file2);
$file = $dom->createTextNode($file);
$thumbnail->appendChild($file);
}
$dom->save($document);
I have tried many different threads and also the paths for the xml file, which is located in the same folder as this code.
Is there something that I am missing that will not load the file?
Thanks in advance,
Pat