<?xml version="1.0" encoding="UTF-8"?>
<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/"
	>

<channel>
	<title>entroducing.com &#187; html data in xml</title>
	<atom:link href="http://www.entroducing.com/view/tag/html-data-in-xml/feed" rel="self" type="application/rss+xml" />
	<link>http://www.entroducing.com</link>
	<description>to prove that i have too much time</description>
	<lastBuildDate>Sun, 15 May 2011 06:00:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Spry with HTML codes/CDATA in XML</title>
		<link>http://www.entroducing.com/view/spry-with-html-codescdata-in-xml</link>
		<comments>http://www.entroducing.com/view/spry-with-html-codescdata-in-xml#comments</comments>
		<pubDate>Sat, 24 Oct 2009 10:54:10 +0000</pubDate>
		<dc:creator>Benny</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Spry]]></category>
		<category><![CDATA[cdata]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html data in xml]]></category>

		<guid isPermaLink="false">http://www.entroducing.com/?p=28</guid>
		<description><![CDATA[I was assigned with a mini project to do a team notice board that read XML files using Spry. While reading plain text in the XML is straightforward,  reading of HTML codes like &#60;br&#62; tag, &#60;b&#62; tag are not. &#38;lt;?xml version=&#38;quot;1.0&#38;quot; encoding=&#38;quot;utf-8&#38;quot;?&#38;gt; &#38;lt;posts&#38;gt; &#38;lt;post&#38;gt; &#38;lt;msg&#38;gt;This is a &#38;lt;strong&#38;gt;message&#38;lt;/strong&#38;gt;&#38;lt;/msg&#38;gt; &#38;lt;/post&#38;gt; &#38;lt;/posts&#38;gt; &#38;lt;msg&#38;gt;This is a &#38;lt;strong&#38;gt;message&#38;lt;/strong&#38;gt;&#38;lt;/msg&#38;gt; When [...]]]></description>
			<content:encoded><![CDATA[<p>I was assigned with a mini project to do a team notice board that read XML files using Spry.<br />
While reading plain text in the XML is straightforward,  reading of HTML codes like &lt;br&gt; tag, &lt;b&gt; tag are not.</p>
<pre class="brush: xml">
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;
&amp;lt;posts&amp;gt;
	&amp;lt;post&amp;gt;
		&amp;lt;msg&amp;gt;This is a &amp;lt;strong&amp;gt;message&amp;lt;/strong&amp;gt;&amp;lt;/msg&amp;gt;
	&amp;lt;/post&amp;gt;
&amp;lt;/posts&amp;gt;
</pre>
<pre class="brush: xml">
&amp;lt;msg&amp;gt;This is a &amp;lt;strong&amp;gt;message&amp;lt;/strong&amp;gt;&amp;lt;/msg&amp;gt;
</pre>
<p>When you type these tags(e.g. strong tag as above) in the XML, it simply &#8216;breaks&#8217; the XML formatting and would thus caused an error when it is loaded with Spry</p>
<p>So&#8230; to input HTML data in XML&#8230;</p>
<p><strong>1. Use CDATA wrapper in your XML </strong></p>
<pre class="brush: xml">
		&amp;lt;msg&amp;gt;
			&amp;lt;![CDATA[
			This is a &amp;lt;strong&amp;gt;message&amp;lt;/strong&amp;gt;
			]]&amp;gt;
		&amp;lt;/msg&amp;gt;
</pre>
<p><strong>2. Set setColumnType(&#8220;msg&#8221;, &#8220;html&#8221;) to your Spry dataset for that field</strong></p>
<pre class="brush: javascript">
var ds1 = new Spry.Data.XMLDataSet(&amp;quot;data.xml&amp;quot;, &amp;quot;posts/post&amp;quot;);
ds1.setColumnType(&amp;quot;msg&amp;quot;, &amp;quot;html&amp;quot;);
</pre>
<p><a href="http://www.entroducing.com/tutorial/spry_with_html_data/spry_with_html_data.zip">Spry with HTML Data Source Code</a></p>
<p><a href="http://www.entroducing.com/tutorial/spry_with_html_data/index.htm">Spry with HTML Data Online Demo</a></p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.entroducing.com%2Fview%2Fspry-with-html-codescdata-in-xml&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.entroducing.com/view/spry-with-html-codescdata-in-xml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

