<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.4" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: 生成XML文档时CDATA段中含有]]&gt;怎么办?</title>
	<link>http://nukq.malmam.com/archives/6</link>
	<description>All about web. AJAX,PHP,XHTML,CSS,Web server...</description>
	<pubDate>Wed, 19 Nov 2008 23:19:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.4</generator>

	<item>
		<title>by: Nukq</title>
		<link>http://nukq.malmam.com/archives/6#comment-42</link>
		<pubDate>Thu, 11 Jan 2007 15:54:36 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-42</guid>
					<description>汗~ 不按照标准，

那就无语了 -.-</description>
		<content:encoded><![CDATA[<p>汗~ 不按照标准，</p>
<p>那就无语了 -.-
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: suozixie</title>
		<link>http://nukq.malmam.com/archives/6#comment-41</link>
		<pubDate>Thu, 11 Jan 2007 15:51:11 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-41</guid>
					<description>如果不是，那么要么XML解析库有问题，要么对方输出的时候胡乱转义。
                                                      ~~~~~~~~~~~~~~~~~~~~~~
                                                    问题就出在这，很多大的网站的rss的文章title
                                                   同时用了CDATA和&amp;转义，而你的只用了&amp;转义。
                                                   有点不好办~_~!</description>
		<content:encoded><![CDATA[<p>如果不是，那么要么XML解析库有问题，要么对方输出的时候胡乱转义。<br />
                                                      ~~~~~~~~~~~~~~~~~~~~~~<br />
                                                    问题就出在这，很多大的网站的rss的文章title<br />
                                                   同时用了CDATA和&amp;转义，而你的只用了&amp;转义。<br />
                                                   有点不好办~_~!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nukq</title>
		<link>http://nukq.malmam.com/archives/6#comment-40</link>
		<pubDate>Thu, 11 Jan 2007 14:40:39 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-40</guid>
					<description>输出XML的时候：如果没有CDATA,那么需要转义；如果有CDATA，那么不需要转义。

按照这个原则，那么你解析XML得到的标题数据肯定是 原始数据(未转义的)

如果不是，那么要么XML解析库有问题，要么对方输出的时候胡乱转义。

因此输出的做一次htmlspecialchars()，也就只做了一次而已。
如果页面显示的时候出现&amp;xxx啥的，肯定是对方输出不标准导致的。</description>
		<content:encoded><![CDATA[<p>输出XML的时候：如果没有CDATA,那么需要转义；如果有CDATA，那么不需要转义。</p>
<p>按照这个原则，那么你解析XML得到的标题数据肯定是 原始数据(未转义的)</p>
<p>如果不是，那么要么XML解析库有问题，要么对方输出的时候胡乱转义。</p>
<p>因此输出的做一次htmlspecialchars()，也就只做了一次而已。<br />
如果页面显示的时候出现&amp;xxx啥的，肯定是对方输出不标准导致的。
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: suozixie</title>
		<link>http://nukq.malmam.com/archives/6#comment-39</link>
		<pubDate>Thu, 11 Jan 2007 14:33:40 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-39</guid>
					<description>如果标题带引号什么的一般blog rss都已经进行了htmlentities了(sohu sina 等)，我再加就两次htmlentities了，显示不正确了。你这个除外~_~</description>
		<content:encoded><![CDATA[<p>如果标题带引号什么的一般blog rss都已经进行了htmlentities了(sohu sina 等)，我再加就两次htmlentities了，显示不正确了。你这个除外~_~
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nukq</title>
		<link>http://nukq.malmam.com/archives/6#comment-38</link>
		<pubDate>Thu, 11 Jan 2007 13:11:52 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-38</guid>
					<description>加你QQ了 :P</description>
		<content:encoded><![CDATA[<p>加你QQ了 :P
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nukq</title>
		<link>http://nukq.malmam.com/archives/6#comment-37</link>
		<pubDate>Thu, 11 Jan 2007 13:05:01 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-37</guid>
					<description>对标题用 htmlspecialchars()处理就够了

对文章内容，因为是html格式，所以可以直接输出，但是这样有隐含的安全问题，建议对内容进行必要的修正和过滤，比较理想的是使用Tidy模块来处理

看我的文章： 
PHP+Tidy－完美的XHTML纠错+过滤
http://nukq.malmam.com/?p=14</description>
		<content:encoded><![CDATA[<p>对标题用 htmlspecialchars()处理就够了</p>
<p>对文章内容，因为是html格式，所以可以直接输出，但是这样有隐含的安全问题，建议对内容进行必要的修正和过滤，比较理想的是使用Tidy模块来处理</p>
<p>看我的文章：<br />
PHP+Tidy－完美的XHTML纠错+过滤<br />
<a href='http://nukq.malmam.com/?p=14' rel='nofollow'>http://nukq.malmam.com/?p=14</a>
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: suozixie</title>
		<link>http://nukq.malmam.com/archives/6#comment-36</link>
		<pubDate>Thu, 11 Jan 2007 12:57:01 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-36</guid>
					<description>htmlentities处理后文章中的图片和段落就没了连也没了。
现在的做法是		$strDescription = strip_tags($strDescription, "");</description>
		<content:encoded><![CDATA[<p>htmlentities处理后文章中的图片和段落就没了连也没了。<br />
现在的做法是		$strDescription = strip_tags($strDescription, "");
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Anonymous</title>
		<link>http://nukq.malmam.com/archives/6#comment-35</link>
		<pubDate>Thu, 11 Jan 2007 12:53:31 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-35</guid>
					<description>用你方法（很通用）改进xajax那应该是最根本的解决办法了，说到底是毕竟是xajax bug。

你们做的东东很精致
很想和你交个朋友，我的QQ：95210236。有机会能见个面最好了</description>
		<content:encoded><![CDATA[<p>用你方法（很通用）改进xajax那应该是最根本的解决办法了，说到底是毕竟是xajax bug。</p>
<p>你们做的东东很精致<br />
很想和你交个朋友，我的QQ：95210236。有机会能见个面最好了
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nukq</title>
		<link>http://nukq.malmam.com/archives/6#comment-34</link>
		<pubDate>Thu, 11 Jan 2007 12:52:34 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-34</guid>
					<description>我想：不管是转义还是 原样放入CDATA中，你用xml库得到后的数据都是未转义的。

所以显示的时候还是要htmlentities处理的。</description>
		<content:encoded><![CDATA[<p>我想：不管是转义还是 原样放入CDATA中，你用xml库得到后的数据都是未转义的。</p>
<p>所以显示的时候还是要htmlentities处理的。
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Nukq</title>
		<link>http://nukq.malmam.com/archives/6#comment-33</link>
		<pubDate>Thu, 11 Jan 2007 12:47:56 +0000</pubDate>
		<guid>http://nukq.malmam.com/archives/6#comment-33</guid>
					<description>嗯，作为html显示的时候肯定要转义的

另外： 我看了我的rss输出。其中 titile虽没有包含在CDATA中， 但是已经转义了啊。

&lt;title&gt;生成XML文档时CDATA段中含有]]&amp;gt;怎么办?&lt;/title&gt;</description>
		<content:encoded><![CDATA[<p>嗯，作为html显示的时候肯定要转义的</p>
<p>另外： 我看了我的rss输出。其中 titile虽没有包含在CDATA中， 但是已经转义了啊。</p>
<p>&lt;title&gt;生成XML文档时CDATA段中含有]]&amp;gt;怎么办?&lt;/title&gt;
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
