Sunday, January 30, 2011

CDATA in Rest Responses

Greetings,
First I want to say thank you all for creating and supporting a great application in cakephp.

At the moment I'm trying to use cakephp to create a RESTful application. I've following the steps here (http://book.cakephp.org/view/1238/REST ) and also here (http://book.cakephp.org/view/1473/XML ) so as to get the xml outputted as tags. All is well in that respect, except one thing.

For the fields that are defined as type vardata in the model, I'm getting the response them enclosed in 'CDATA' as follows:

<crops>
 <crop><id>1</id><parish><![CDATA[St.Elizabeth]]></parish><crop_group><![CDATA[Vegtables]]></crop_group><crop_type><![CDATA[Carrots]]></crop_type><quantity>40</quantity></crop> <crop><id>2</id><parish><![CDATA[St.Thomas]]></parish><crop_group><![CDATA[Fruits]]></crop_group><crop_type><![CDATA[Apples]]></crop_type><quantity>20</quantity></crop> <crop><id>3</id><parish><![CDATA[St.Ann]]></parish><crop_group><![CDATA[Permanent Crop]]></crop_group><crop_type><![CDATA[Banana]]></crop_type><quantity>70</quantity> </crop> </crops>  Is there a way to get the CDATA removed from the output? Please advise.   Thank you again.  Regards, Matthew M 

No comments: