精简WordPress eXtended Rss (WXR) 文件格式

经过N次Import和数据库清空,终于将之前的WXR文件格式的完备集简化了。

简化原则是适应Sina2WordPress项目的需要,尽可能精简文件大小,删除了导入无效的(如博客标题、博客链接等)和从新浪博客中无法获取的(如评论者的链接和IP等)信息,还有item之前的的作者、分类和标签信息。作者在导入时可以指定的,反而加上会有可能的错误,分类和标签的信息用post中的分类和标签就可以自动统计了。没想明白为什么非要单独列出来,难道是为了空的分类和标签,那还要它干嘛?

一些必不可少的标签及错误总结:
1、wxr_version,缺少会提示“missing/invalid WXR version number”的错误
2、status,否则都会显示成draft
3、post_type,否则无法导入
4、comment_approved,否则无法导入

WordPress eXtended Rss (WXR)文件格式解析

Sina2WordPress的第一步——解析WXR文件格式

WXR是Wordpress eXtended Rss的缩写,是WordPress针对博客信息特意设定的格式,它最大的优点是兼容性好,包含信息丰富

通过参照导出的文件,初步找到一个完备集(见下方代码),经测试在WP无任何内容情况下无信息缺漏错误现象

下方代码已经尽可能的注释了所有可能的标签和属性,并且由于一些标签和属性与Sina2WordPress关系不大,故未深究

参考:http://ipggi.wordpress.com/2011/03/16/the-wordpress-extended-rss-wxr-exportimport-xml-document-format-decoded-and-explained/

A recommended kind of RSS solution

Today I want to recommend a kind of RSS solution and  it’s just what I use for my blog.

In this way, we will have a permanent and unique rss url. As for me, it’s http://feeds.huxuan.org/huxuan

1)Sign up as the same name for your feed in FeedSky & FeedBurner.

e.g. I have
http://feed.feedsky.com/huxuan for FeedSky &
http://feeds.feedburner.com/huxuan for FeedBurner
(I just have it for example, Please don’t subscribe my blog through this two address)

2) Use the Domain Binding Service which Feedburner & Feedsky both provide to host the feed by your own domain name

You should choose only one of the two & Feedburner is recommended absolutely
You need to create a CNAME entry in the DNS records here
More information are provided by Feedburner & Feedsky when you configure the Domain Binding Service

3) Change the feed source you didn’t choose in step 2

e.g. I choose Feedburner to create the feed, so I change the feed source of Feedsky just into http://feeds.huxuan.org/huxuan.

4)Change the default rss url of wordpress

In the header.php of theme we use, similar code can be found like this:

Change the url with underline into the feed you have created.

5)Change all possible default feed url on the site

There may be many default feed url list on the site most presenting as a link of an image or some else.
Just search for it and change it!

Attention: Some Errors happen in Step 6. Ignore it now.

6)Redirect the default feed url to the new one just in case

Insert the code below to .htacess which located in the main directory

7)Now all steps is done, just share your unique & permanet feed url to your friends

if one of the two feed service providers don’t work, just change to the other one via repeating Step 2 & 3

P.S. If there’s any error or problem, please feel free to inform me of that.