Page 1 of 1

XML DOM

Posted: Wed May 07, 2008 10:36 am
by rootseire
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

Re: XML DOM

Posted: Wed May 07, 2008 4:01 pm
by kendall
do you get any errors?

maybe you should ensure you have XML lib installed for php...most hosts don't

Re: XML DOM

Posted: Wed May 07, 2008 7:57 pm
by rootseire
I think that's what I need, haven't been getting any errors so far. Where can I find an easy to install XML lib online?
Thanks a mil,
Pat

Re: XML DOM

Posted: Mon May 12, 2008 4:21 am
by rootseire
i've inserted a line of php code 'echo("xmldom loading");' before the $dom->load function, and the code works fine. However, when i insert the php code after the $dom->load function, the php code doesn't show up.

Does this mean that the xml lib isn't installed for php? Or could it mean that the path might be incorrect. Any help would be greatly appreciated.

Thanks,
Pat

Re: XML DOM

Posted: Mon May 12, 2008 11:26 am
by rootseire
Just checked the libxml on the server, please see the attached file.

Is there something extra i need?

Thanks,
Pat

Re: XML DOM

Posted: Thu May 15, 2008 7:21 am
by rootseire
Can anyone give an answer on this?
I've tried installing the libxml and still no luck with it.
Thanks,
Pat