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
XML DOM
Moderator: General Moderators
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Re: XML DOM
do you get any errors?
maybe you should ensure you have XML lib installed for php...most hosts don't
maybe you should ensure you have XML lib installed for php...most hosts don't
Re: XML DOM
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
Thanks a mil,
Pat
Re: XML DOM
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
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
Just checked the libxml on the server, please see the attached file.
Is there something extra i need?
Thanks,
Pat
Is there something extra i need?
Thanks,
Pat
- Attachments
-
- domxml.JPG (26.84 KiB) Viewed 1859 times
Re: XML DOM
Can anyone give an answer on this?
I've tried installing the libxml and still no luck with it.
Thanks,
Pat
I've tried installing the libxml and still no luck with it.
Thanks,
Pat