XML DOM

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
rootseire
Forum Newbie
Posts: 5
Joined: Wed May 07, 2008 8:59 am

XML DOM

Post 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
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: XML DOM

Post by kendall »

do you get any errors?

maybe you should ensure you have XML lib installed for php...most hosts don't
rootseire
Forum Newbie
Posts: 5
Joined: Wed May 07, 2008 8:59 am

Re: XML DOM

Post 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
rootseire
Forum Newbie
Posts: 5
Joined: Wed May 07, 2008 8:59 am

Re: XML DOM

Post 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
rootseire
Forum Newbie
Posts: 5
Joined: Wed May 07, 2008 8:59 am

Re: XML DOM

Post by rootseire »

Just checked the libxml on the server, please see the attached file.

Is there something extra i need?

Thanks,
Pat
Attachments
domxml.JPG
domxml.JPG (26.84 KiB) Viewed 1858 times
rootseire
Forum Newbie
Posts: 5
Joined: Wed May 07, 2008 8:59 am

Re: XML DOM

Post by rootseire »

Can anyone give an answer on this?
I've tried installing the libxml and still no luck with it.
Thanks,
Pat
Post Reply