XML Structure breaking not parsing via PHP, producing error document is empty


I would like some guidance, please. I have been trying to implement an XML structure, then it gets parsed through PHP to get the final result. This system wasn’t set by me but someone else, so I am bit lost.

The structure seems fine until these two tags are added

Then I am getting the error: [b]"This page contains the following errors: error on line 1 at column 1: Document is empty Below is a rendering of the page up to the first error." [/b]If I remove these tags, the feed works fine, parses through PHP just fine.

This is the structure:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msn="http://microsoft.com/msnrss" xmlns:dcterms="http://purl.org/dc/terms/">
<channel><source>Media</source><description>Video feed</description>
<media:content url="***videoURL***" type="video/mp4"></media:content>
<videoCover> <media:thumbnail height="650" width="1000" type="image/jpeg" url="***img1***"/></videoCover>
<![CDATA[ ***people*** ]]>

This is the part of PHP which parses the MRSS, where I think is problem:

[php] case ‘mrss’:

                    foreach ($items as $key => $item) {
                        $vidFile = $item->vurl;

                        $vidFilename = $this->rootPath . '/' . $target->filePath . '/' . $vidFile;

                        if ($this->devMode == true) {
                            $fileExists = true;
                            $item->vidfs = 12345;
                        } else {
                            $fileExists = file_exists($vidFilename);
                            if (!$fileExists) {
                                $this->saveFile($this->sourceHost . '/' . $item->vurl, $vidFilename);
                                $fileExists = file_exists($vidFilename);

                                if ($fileExists)
                                    $item->vidfs = filesize($vidFilename);

                        if ($fileExists) {
                            $item->vidfn = 'http://' . $_SERVER['HTTP_HOST'] . $target->fileUrlRoot . '/' . $vidFile;
                            $data = str_replace($item->find, $item->vidfn, $data);

                        } else {
                            $this->errors[] = 'Missing Video ' . $vidFile;

                    if (isset($target->processContent)) {
                        $pc = $target->processContent;
                        $data = $pc($data);


                    if ($this->debug)
                        $this->debugging[] = 'Items Processing for ' . $details->expected . " is missing";

                    $this->errors[] = 'Items Processing is not configured';

            return true;

        } else {
            $this->errors[] = 'Could not find any feed Items';[/php]

I have tried changing the header-type but it doesn’t make any difference either. I would appreciate some help with this.
I have also attached the exact error screenshot.



Based on the image, it doesn’t look like it is parsing, but rather trying to display the XML instead?


It displays the XML we set up on one end. Then using the php code it actually sends it through the server to display it with the content attached from the database.

But for some reason php is not accepting those two tags , that what causes the issue with php and xml, otherwise it works perfectly fine. I just cannot seem to figure out.


What is $items?

$item->vurl doesn’t look like a valid object in the file, so it would throw an error. Have you checked your error log for additional information?


This is the errror I got from the error log:

PHP Warning: UnifiedFeed::processMrss(): Node no longer exists in /var/www/unified-feed-theory.php on line 660, referer:

And this is the code on line 660:
$encryptedUrl = trim((string) $xmlItem->children($namespaces[‘media’])->content->attributes()->url);

The $items is where the video contents are added and the video url is changed and given a proper url with extension.
Do I need to post the entire php code?


Understanding all the pieces will help streamline finding out what is happening. The 500 error is a generic, catch all, that doesn’t give much information. Somewhere in your script there is a fatal error that is causing the entire thing to stop functioning. That could be trying to access the element that it can’t find or a number of other things that are hard to sort out with only partial information.


Thank you… as I replied above… after checking error logs, this is what is causing error:

PHP Warning: UnifiedFeed::processMrss(): Node no longer exists in /var/www/unified-feed-theory.php on line 660, referer:

And this is the code on line 660:
$encryptedUrl = trim((string) $xmlItem->children($namespaces[‘media’])->content->attributes()->url);


So the colon is causing the issue.

Here is a post on how to deal with the colon in the tag element, http://blog.stuartherbert.com/php/2007/01/07/using-simplexml-to-parse-rss-feeds/


Thank you so much for your help. :slight_smile:


I take it the article helped you resolve the there but not found node?