Jump to content


This topic is now archived and is closed to further replies.


php script acts weird with DOM-generated xml file

Recommended Posts

I've been puzzling with this problem for the last two days and can't figure it out..

What i'm trying to do is adding (news)item to an xml file (i didn't use rss, don't ask me why..) with the DOM-interface for a small CMS.
So far that all working fine, the values from the form are beiing added as a new item at the end of the document (but within the rootNode of course)
The issue is that the added node is written on just one line, and for some reason the script that lists the newsitems can't deal with that.
It gives me the following error:
"[b]Notice:[/b] Trying to get property of non-object in ... "

In addition to that it also 'mixes up' some nodes.
De structure of the xml file is as follows:

News (rootNode)

When it lists the items, the description is shown instead of the title.

When i mark the (newly added item) up tidy and put all the childNOdes of 'item' on a new line, everything works fine.
I couldn't find anything apart from the php-function 'tidy_repair_file', but this library is not installed on the server is going to run on, so that soen't help m emuch either.

I'm fresh out of solutions, suggestions anyone?

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.