Aneesh
Aneesh

Reputation: 1733

TBXML doesn't parse tag with special character as value

I'm trying to parse an XML using TBXML and everything is going fine except for tags which contain special characters in their value.

For example, consider the XML element <tag> sources/data </tag>

I'm trying to get the text sources/data from this tag. I'm using [TBXML textForElement:element] to achieve this. But it always returns an empty string. The same code fails for another tag which is defined as : <tag> array[i] </tag>.

But it works fine for normal text values like <tag>name</tag>.

Can anyone help me out here ?

Upvotes: 1

Views: 105

Answers (1)

Sergei Nikitin
Sergei Nikitin

Reputation: 788

Quote: "Because XML syntax uses some characters for tags and attributes it is not possible to directly use those characters inside XML tags or attribute values."

http://www.dvteclipse.com/documentation/svlinter/How_to_use_special_characters_in_XML.3F.html

As I know this kind of data must be in placed CDATA.

Upvotes: 0

Related Questions