首页 > 解决方案 > 文档 XML 末尾的额外内容

问题描述

所以我不得不手动创建一个 xml iTunes 提要,因为我们使用 mongodb 和 reactjs 作为我们的后端。

基本上我遇到的问题是IE浏览器在说

This page contains the following errors:
error on line 23 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.

但是第 23 行是

</xml>

所以我不确定它是如何出错的

谁能指出我在这个xml中的哪个地方有错误。(注意我知道还没有项目)

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" version="2.0">
<channel>
<title>Rant Show</title>
<link>http://rant.show</link>
<language>en-us</language>
<itunes:subtitle>Rant show is a show that allows you to rant about the topics and subjects close to you in an open forum.</itunes:subtitle>
<itunes:author>Radio Media PTY LTD</itunes:author>
<itunes:summary>Join us every week, for a new episode of the Rant Show. Where we talk about the topics that have everyone grasping.</itunes:summary>
<description>Ever felt like a rant but never had friends you could rant with. Well this podcast is all about just that. No topic is off topic and everyone is free to rant about school, work, laws or any subject. We love free speech and thrive on your feedback and suggestions.</description>
<itunes:owner>
<itunes:name>Radio Media PTY LTD</itunes:name>
<itunes:email>podcast@radiomedia.com.au</itunes:email>
</itunes:owner>
<itunes:explicit>yes</itunes:explicit>
<itunes:image href="http://www.example.com/podcast-icon.jpg" />
<itunes:category text="News">
<itunes:category text="News Commentary"/>
</itunes:category>
<atom:link href="http://api.radiomedia.com.au/api-access/shows/rantshow" rel="self" type="application/rss+xml" />
</channel>
</rss>
</xml>

标签: xmlinternet-explorer

解决方案


我认为你应该删除</xml>标签。在 xml 文件中,<?xml version="1.0" encoding="UTF-8"?>称为XML prolog。在w3schools 的XML 语法中,它说:

注意:XML 序言没有结束标记!这不是错误。序言不是 XML 文档的一部分。

我还找到了一个为 iTunes 播客创建 RSS 提要的示例,如果需要,可以参考它。


推荐阅读