views:

118

answers:

1

Hi,

I am creating an xml using php and parsing that xml in iphone application code. In description field there is some html tags and text.

I am using following line to convert this html tags in to xml tag using CDATA.

 $response .= '<desc><![CDATA['.trim($feed['fulltext']).']]></desc>';

Now, here my $feed['fulltext'] value is like this

<span class="ABC">...text...</span>

In xml I am getting following response,

<desc><![CDATA[><span class"ABC">...text...</span>]]></desc>

You can see here, I am getting an extra greater-than symbol just before the value of $feed['fulltext'] starts. (like this: >...text...)

Any solution or suggestion for this?

Thanks in advance. Cheers.

A: 

Have you tried not using cdata and just xml/html encoding the value of ? That's normally my preferred way of sending html over xml.

i.e.

<desc>&lt;span class=&quot;ABC&quot;&gt;...text...&lt;/span&gt;</desc>

Sorry I can't help with the extra > as I'm more of a .net developer than php.

Amethi