RSS feed question
Do I really need all those xmlns links in my RSS code?
what does the following code mean?
<rss version="2.0"
xmlns:content="http://purl.org/rss/开发者_运维知识库1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
>
The xmlns
properties define XML namespaces.
For instance, xmlns:atom="http://www.w3.org/2005/Atom"
defines the namespace atom
to be the URI
http://www.w3.org/2005/Atom.
Then, when you create a <atom:link>
element, you can see it as having the URI http://www.w3.org/2005/Atom/link, which the parser will know is a link, as defined in the Atom specification.
Note, the parser cannot go by the name of the namespace, as you just as easily could have used xmlns:a="http://www.w3.org/2005/Atom"
, which would make <a:link>
the Atom link tag.
精彩评论