未定义的项目元素 XML/RSS [英] Undefined item element XML/RSS

查看:39
本文介绍了未定义的项目元素 XML/RSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我修改了 Wordpress RSS 提要,但出现 RSS 验证错误.我该如何解决这些问题?我在哪里/如何定义这些名称空间等?

I modified the Wordpress RSS feed, but I get RSS validation errors. How do I fix these? Where/how do I define these name spaces etc.?

未定义的项目元素:内容:自定义

Undefined item element: content:custom

http://tinyurl.com/npgmha3

推荐答案

根据评论中的讨论,您的实际问题是这样的:

Based on discussion in the comments, your actual problem is this:

我想在我的 RSS 提要中添加一些自定义标签,以便将其视为有效提要,但我自己的脚本可以从中获取一些其他读者会完全忽略的额外信息.

I want to add some custom tags to my RSS feed so that it is treated as a valid feed, but my own script can get some extra information out of it which other readers will completely ignore.

在您尝试的解决方案中,您已将这些添加到 W3C 的验证服务知道的现有命名空间中,因此拒绝了这些元素.

In your attempted solution, you have added these into an existing namespace, which the W3C's validation service has knowledge of, and is thus rejecting the elements.

定义您自己的元素的正确方法是在您自己的命名空间中 - 由于您控制着命名空间,除了您之外,没有人可以说您的元素在该命名空间中是错误的".这只需要三个步骤:

The right way to define your own elements is in your own namespace - since you control the namespace, nobody but you can say that your elements are "wrong" in that namespace. This requires only three steps:

  1. 选择一个您控制的 URI 作为命名空间标识符,例如http://teleeon.com/custom-rss-extensions/.您实际上不必在此 URL 中添加任何特定内容,尽管解释您为什么这样做的页面可能对在您的供稿中遇到它的任何好奇的人有用.
  2. 在提要顶部为该命名空间分配一个别名,以及所有现有的别名,例如xmlns:teleeon="http://teleeon.com/custom-rss-extensions/"
  3. 使用该自定义命名空间别名为所有元素(和属性)添加前缀,例如<teleeon:customContent teleeon:key='test_field'>fasdfsadfsadf åäö http://www.adasdasd.com</teleeon:customContent>
  1. Pick a URI that you control to be the namespace identifier, e.g. http://teleeon.com/custom-rss-extensions/. You don't actually have to put anything particular at this URL, although a page explaining why you've done it might be useful for anyone curious who comes across it in your feed.
  2. Assign an alias at the top of the feed to that namespace, along with all the existing ones, e.g. xmlns:teleeon="http://teleeon.com/custom-rss-extensions/"
  3. Prefix all your elements (and attributes) with that custom namespace alias, e.g. <teleeon:customContent teleeon:key='test_field'>fasdfsadfsadf åäö http://www.adasdasd.com</teleeon:customContent>

如果您希望将图像和自定义字段作为单独的命名空间,只需为第二个命名空间重复步骤 1 到 3.

If you want to have your images and custom fields as separate namespaces, just repeat steps 1 to 3 for a second namespace.

这篇关于未定义的项目元素 XML/RSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆