我想要一些指导。我一直在尝试实现XML结构,然后通过PHP解析它以获得最终结果。这个系统不是我设定的,而是其他人,所以我有点迷失。
在添加这两个标签之前,结构似乎很好
<videoItems> <videoItem> </videoItem> </videoItems>
然后我收到错误:“此页面包含以下错误:第1行第1行的错误:文档为空下面是第一个错误的页面呈现。”如果我删除这些标签,那么Feed会很好,通过PHP解析就好了。
这是结构:
<?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>
<item>
<title>***headline***</title>
<videoItems>
<videoItem>
<media:content url="***videoURL***" type="video/mp4"></media:content>
<videoFiletype>video/mp4</videoFiletype>
<videoDesc>***abstract***</videoDesc>
<videoLang>EN</videoLang>
<videoCover> <media:thumbnail height="650" width="1000" type="image/jpeg" url="***img1***"/></videoCover>
<media:keywords>
<![CDATA[ ***people*** ]]>
</media:keywords>
<videoTags>
<tag>***people***,***location***,***brands***</tag>
</videoTags>
</videoItem>
</videoItems>
<pubDate>***story_publish_ISO***</pubDate>
</item>
</channel>
</rss>
这是PHP解析MRSS的部分:
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);
}
$this->setContent($data);
break;
default:
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';
我尝试更改标题类型,但它也没有任何区别。 我将不胜感激。