CDATA Syntax
Syntax for CDATA section
<![CDATA[ ]]>
CDATA VS XML Parser
When we type some internal code, CSS and JS between <style> and <style> or <script> and <script>, before we left the Blogger HTML Editor, the block of code looks normal. If we comeback to the editor and see our code, we will found them look nasty. This because the XML has encoded or parsed our code. To avoid that, we must bring CDATA along, to keep our code look beauty.CDATA Eexample
CSS without CDATA
<style type='text/css'> .class ul>li:before { content: "♥"; } </style>
CSS with CDATA
<style type='text/css'> /* <![CDATA[ */ .class ul>li:before { content: "♥"; } /* ]]> */ </style>
Sometimes, our Javascript marked as Error and XML Blogger HTML Editor wont accept our code, this, because we have special charachter present in our code such as an & (ampersand) to avoid an error, we must decode our JS or wrapping them inside CDATA section.
Javascript without CDATA
<script> if (foo > bar && baz < foo) { alert('Boo'); } </script>
Javascript with CDATA
<script> //<![CDATA[ if (foo < bar && baz < foo) { alert('Boo'); } //]]> </script>
The tag <b:widget-setting> value are aslo parsed by XML, we can use cdata inlining with them to its value to avoid encoded text.
Value of a Widget setting without CDATA
<b:widget-setting name='content'> <p>Don't Parsing Me</p> </b:widget-setting>
Value of a Widget setting with CDATA
<b:widget-setting name='content'> <![CDATA[ <p>Don't Parsing Me</p> ]]> </b:widget-setting>
Other Tag
- <b:attr>
- <b:case>
- <b:class>
- <b:comment>
- <b:default>
- <b:defaultmarkup>
- <b:defaultmarkups>
- <b:eval>
- <b:else>
- <b:elseif>
- <b:if>
- <b:include>
- <b:includable>
- <b:loop>
- <b:message>
- <b:param>
- <b:section>
- <b:skin>
- <b:switch>
- <b:tag>
- <b:template-script>
- <b:template-skin>
- <b:widget>
- <b:widget-setting>
- <b:widget-settings>
- <b:with>
- <![CDATA[]]>
- <data:.../>