Jump to content

php script acts weird with DOM-generated xml file


bruijn88

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)
..|-item
.......|-title
.......|-description
.......|-image

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?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.