dsvf46980 2010-12-03 04:13
浏览 25

解析错误 - 使用CodeIgniter创建RSS源

Hey guys, I'm creating an rss feed with codeigniter and I get the specific error: XML Parsing Error: junk after document element Location: http://mysite.com/feeds/latest

After googling it and not being able to find a solution to my issue (despite a ton of results) I came here for some advice.

I have

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>

Followed by my websites title, link, description, pubdate, dc:date tags.

Followed by a foreach statement that loops results like so:

<?php foreach($feedResults as $feedItem): ?>
 <item>
       <title><?php echo $feedItem->title; ?></title>
          <link><?php echo site_url('/'.$feedItem->ID) ?></link>
          <guid><?php echo site_url('/'.$feedItem->ID) ?></guid>
    <description>descri[</description>
          <pubDate><?php echo date ('r', $feedItem->time());?></pubDate>
    </item>        
    <?php endforeach; ?>

My codeigniter controller doesn't do much besides retrieve $feedResults, sets the header to : header("Content-Type: text/xml"); and then passes the results to the view.

Thanks guys.

  • 写回答

2条回答 默认 最新

  • donglu953744 2010-12-03 04:19
    关注

    "Location: http://mysite.com/feeds/latest" looks like an HTTP header (location headers are how redirects work). Are you passing a URL that redirects to another URL to an XML parser that can't follow redirects?

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题