我可以在 rss 项目中添加我自己的标签吗? [英] Can I add my own tags in a rss item?

查看:34
本文介绍了我可以在 rss 项目中添加我自己的标签吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 rss xml 文件中,我有我的频道和几个项目.通常,该项目具有标题、链接、描述,可能还有时间或其他内容.我可以把我自己的标签和我想发送的额外数据放在一起吗?

In the rss xml file I have my channel and several items. Typically the item has a title, link, description and maybe time or something. Can I put my own tags in there with additional data I want to send?

示例:假设是一个包含天气/温度信息的 RSS 提要,我可能有多个项目标签,每个城市一个.然后在描述中我会有我的字符串描述.但是,如果我还想为温度、风速、高、低、英寸雨天等放置单独的标签,我可以在其他客户端上进行不同的解析.

Example: Say if was a doing a rss feed to contains weather/temperature info, I might have several item tags, with one for each city. And then in the description I would have my string description. But if I wanted to also put separate tags for temperature, windspeed, high, low, inchesOfRain, etc too I could have something parse that differently on some other client.

推荐答案

是的,你可以 - 为你的标签创建一个新的命名空间(它是标准的 XML).

Yes you can - create a new namespace for your tags (it's standard XML).

示例:

<?xml version="1.0"?>
<rss version="2.0" xmlns:w="http://tempuri.org">
    <channel>
        ...
        <item>
            <title>Item title</title>
            <description>...</description>
            <w:temperature>...</w:temperature>
            <w:windspeed>...</w:windspeed>
        </item>
    </channel>
</rss>

也就是说,也许您应该先进行一些搜索,看看是否有满足您需求的现有格式.标准 == 好 :)

That said, perhaps you should do a little searching first to see if there's an existing format that meets your needs. Standards == good :)

参见 http://www.feedforall.com/namespaces.htmhttp://base.google.co.uk/support/bin/answer.py?answer=58085&hl=zh_CN

这篇关于我可以在 rss 项目中添加我自己的标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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