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 <br> tag, <b> tag are not.
<?xml version="1.0" encoding="utf-8"?> <posts> <post> <msg>This is a <strong>message</strong></msg> </post> </posts>
<msg>This is a <strong>message</strong></msg>
When you type these tags(e.g. strong tag as above) in the XML, it simply ‘breaks’ the XML formatting and would thus caused an error when it is loaded with Spry
So… to input HTML data in XML…
1. Use CDATA wrapper in your XML
<msg> <![CDATA[ This is a <strong>message</strong> ]]> </msg>
2. Set setColumnType(“msg”, “html”) to your Spry dataset for that field
var ds1 = new Spry.Data.XMLDataSet("data.xml", "posts/post"); ds1.setColumnType("msg", "html");
- Posting Source Code in WordPress
- Premature end of script headers in perl script
- symfony conditional validation
- building new app with symfony : week 1
- Making a Struts Radio