首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Podcast RSS提要中的"XML解析错误:<unknown>:2:0:未绑定前缀“

Podcast RSS提要中的"XML解析错误:<unknown>:2:0:未绑定前缀“
EN

Stack Overflow用户
提问于 2020-07-21 12:25:33
回答 1查看 1.1K关注 0票数 4

我正试图用我自己写的RSS提要来自我发布我的播客。当我检查它是否在https://validator.w3.org/feed/上验证时,我总是在标题中得到错误,它说错误在第2行,即RSS标记本身。我检查了代码,并将其与有效的RSS提要进行了比较,结果完全相同,所以我不知道问题是什么,而且w3也没有给我任何关于如何修复它的指示。这是我的密码:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
     xmlns:media="http://search.yahoo.com/mrss/"
     xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
     xmlns:dcterms="http://purl.org/dc/terms/"
     xmnls:spotify="https://www.spotify.com/ns/rss"
     xmlns:atom="http://www.w3.org/2005/Atom">

如果有人能告诉我,我做错了什么,如何修复它,以便提要将验证,这将是非常感谢。

编辑以包括完整代码:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
     xmlns:media="http://search.yahoo.com/mrss/"
     xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
     xmlns:dcterms="http://purl.org/dc/terms/"
     xmnls:spotify="https://www.spotify.com/ns/rss"
     xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <!-- Main Information -->
        <Title>Entitled Gamers</Title>
        <description>Two friends and streamers SamuraiHerc and PoopShizzle get together once a week to chat about what's new and trending in gaming, streaming, and content creating.</description>
        <link>https://www.mobomu.com/podcasts/entitledgamers/entitledgamers.html</link>
        <image>
            <url>https://www.mobomu.com/podcasts/entitledgamers/img/cover.jpg</url>
        </image>
        <!-- Optional Information -->
        <language>en-US</language>
        <copyright>Copyright 2020, Mobomu Gaming Network</copyright>
        <managingEditor>poopshizzle@mobomu.com</managingEditor>
        <webMaster>herc@mobomu.com</webMaster>
        <!-- iTunes Specifics -->
        <itunes:author>Mobomu</itunes:author>
        <itunes:owner>
            <itunes:name>Mobomu</itunes:name>
            <itunes:email>entitledgamers@mobomu.com</itunes:email>
        </itunes:owner>
        <itunes:image url="https://www.mobomu.com/podcasts/entitledgamers/img/cover.jpg"/>
        <itunes:category text="Leisure">
            <itunes:category text="Video Games" />
        </itunes:category>
        <itunes:category text="Comedy" />
        <itunes:category text="News">
            <itunes:category text="Entertainment News" />
        </itunes:category>
        <itunes:summary>Two friends and streamers SamuraiHerc and PoopShizzle get together once a week to chat about what's new and trending in gaming, streaming, and content creating.</itunes:summary>
        <itunes:type>episodic</itunes:type>
        <!-- Spotify Specifics -->
        <spotify::countryOfOrigin>us</spotify::countryOfOrigin>

        <!-- Episode 1 -->
        <item>
            <title>Games are Getting More Expensive?</title>
            <enclosure url="https://www.mobomu.com/podcasts/entitledgamers/audio/episode-001.mp3"
                       length="103132759" type="audio/mpeg"/>
            <description>NBA 2K sparks the AAA game price hike conversation. Ninja streams to YouTube without a contract. And Destiny 2's Twitch plugin breaks site-wide subtrain records for big streamers.</description>
            <guid>fd63b88b-2714-43c4-9840-d2dc247dda33</guid>
            <pubDate>Sun, 12 Jul 2020 14:50:59 GMT</pubDate>
            <!-- iTunes Specifics -->
            <itunes:duration>42:57</itunes:duration>
            <itunes:episodeType>full</itunes:episodeType>
            <itunes:episode>1</itunes:episode>
            <itunes:season>1</itunes:season>
            <itunes:explicit>no</itunes:explicit>
        </item>
        
        <!-- Episode 2 -->
        <item>
            <title>Are Gamers Tired of Battle Royales?</title>
            <enclosure url="https://www.mobomu.com/podcasts/entitlegamers/audio/episode-002.mp3"
                       length="96854827" type="audio.mpeg"/>
            <description>Ubisoft's HyperScape is a new Battle Royale game that resurfaces the age-old "gamers are tired of this genre" conversation, but are they really?</description>
            <guid>33bdc13a-8c1a-430e-a7c3-709b0d1928e4</guid>
            <pubDate>Sun, 19 Jul 2020 17:00:00 GMT</pubDate>
            <!-- iTunes Specifics -->
            <itunes:duration>40:21</itunes:duration>
            <itunes:episodeType>full</itunes:episodeType>
            <itunes:episode>2</itunes:episode>
            <itunes:season>1</itunes:season>
            <itunes:explicit>no</itunes:explicit>
        </item>
    </channel>
</rss>

编辑2:由于下面的kjhughes的帮助,我能够解决RSS标记中的错误(这是一个错误),然后w3能够在我的代码中找到更多的错误,这些错误一旦修复,就会得到验证。我将发布经过验证的RSS提要代码,供其他可能有类似问题的人参考:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
     xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
     xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <!-- Main Information -->
        <title>Entitled Gamers</title>
        <description>Two friends and streamers SamuraiHerc and PoopShizzle get together once a week to chat about what's new and trending in gaming, streaming, and content creating.</description>
        <link>https://www.mobomu.com/podcasts/entitledgamers/entitledgamers.html</link>
        <image>
            <title>Entitled Gamers</title>
            <link>https://www.mobomu.com/podcasts/entitledgamers/entitledgamers.html</link>
            <url>https://www.mobomu.com/podcasts/entitledgamers/img/cover.jpg</url>
        </image>
        <atom:link href="https://www.mobomu.com/podcasts/entitledgamers/rss/feed.xml" rel="self" type="application/rss+xml" />
        <!-- Optional Information -->
        <language>en-US</language>
        <copyright>Copyright 2020, Mobomu Gaming Network</copyright>
        <managingEditor>poopshizzle@mobomu.com (PoopShizzle)</managingEditor>
        <webMaster>herc@mobomu.com (SamuraiHerc)</webMaster>
        <!-- iTunes Specifics -->
        <itunes:author>Mobomu</itunes:author>
        <itunes:owner>
            <itunes:name>Mobomu</itunes:name>
            <itunes:email>entitledgamers@mobomu.com</itunes:email>
        </itunes:owner>
        <itunes:image href="https://www.mobomu.com/podcasts/entitledgamers/img/cover.jpg"/>
        <itunes:category text="Leisure">
            <itunes:category text="Video Games" />
        </itunes:category>
        <itunes:category text="Comedy" />
        <itunes:category text="News">
            <itunes:category text="Entertainment News" />
        </itunes:category>
        <itunes:summary>Two friends and streamers SamuraiHerc and PoopShizzle get together once a week to chat about what's new and trending in gaming, streaming, and content creating.</itunes:summary>
        <itunes:type>episodic</itunes:type>
        <itunes:explicit>clean</itunes:explicit>

        <!-- Episode 1 -->
        <item>
            <title>Games are Getting More Expensive?</title>
            <enclosure url="https://www.mobomu.com/podcasts/entitledgamers/audio/episode-001.mp3"
                       length="103132759" type="audio/mpeg"/>
            <description>NBA 2K sparks the AAA game price hike conversation. Ninja streams to YouTube without a contract. And Destiny 2's Twitch plugin breaks site-wide subtrain records for big streamers.</description>
            <guid isPermaLink="false">fd63b88b-2714-43c4-9840-d2dc247dda33</guid>
            <pubDate>Sun, 12 Jul 2020 14:50:59 GMT</pubDate>
            <!-- iTunes Specifics -->
            <itunes:duration>42:57</itunes:duration>
            <itunes:episodeType>full</itunes:episodeType>
            <itunes:episode>1</itunes:episode>
            <itunes:season>1</itunes:season>
        </item>
        
        <!-- Episode 2 -->
        <item>
            <title>Are Gamers Tired of Battle Royales?</title>
            <enclosure url="https://www.mobomu.com/podcasts/entitlegamers/audio/episode-002.mp3"
                       length="96854827" type="audio/mpeg"/>
            <description>Ubisoft's HyperScape is a new Battle Royale game that resurfaces the age-old "gamers are tired of this genre" conversation, but are they really?</description>
            <guid isPermaLink="false">33bdc13a-8c1a-430e-a7c3-709b0d1928e4</guid>
            <pubDate>Sun, 19 Jul 2020 17:00:00 GMT</pubDate>
            <!-- iTunes Specifics -->
            <itunes:duration>40:21</itunes:duration>
            <itunes:episodeType>full</itunes:episodeType>
            <itunes:episode>2</itunes:episode>
            <itunes:season>1</itunes:season>
        </item>
    </channel>
</rss>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-07-21 12:36:06

总体而言

必须声明正在使用的所有XML命名空间。

具体来说,文档中的每个XML元素名称都带有表单,

代码语言:javascript
复制
nspref:LocalName

必须像这样声明

代码语言:javascript
复制
xmlns:nspref="http://example.com/ns"

在该元素或其祖先的nspref名称空间前缀。

在你的情况下

在其中一个命名空间声明中有一个错误:

代码语言:javascript
复制
 xmnls:spotify="https://www.spotify.com/ns/rss"
   ^^

应该是

代码语言:javascript
复制
 xmlns:spotify="https://www.spotify.com/ns/rss"
   ^^

而且,是的,在解决了这一问题之后,可能会发现其他问题。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63014523

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档