Shishir.bobby
Shishir.bobby

Reputation: 10984

NOt able to parse "&"

My xml consist of words in few different language, Latin words etc. am able to parse these Latin characters and all except the fact that I am not able parse only "&"

This is what I am getting @gdb

Entity: line 223: parser error : > xmlParseEntityRef: no name Ull > always be mine 4 now & 4ever.Ull > always be mine 4 u r my treasure.Ull

Upvotes: 2

Views: 743

Answers (2)

avuthless
avuthless

Reputation: 996

I used this simple line of code in my case before parsing that xml:

cleaned = [original stringByReplacingOccurrencesOfString:@"&" withString:@"&"];

I did use [NSString stringByDecodingHTMLEntities]; Just before that since my server returns messages with tags.

Upvotes: 0

oluies
oluies

Reputation: 17831

The ampersand is treated as a special character because it is a special character. Ampersand is the start of an entity.

Ampersand ("&") needs to be written as & amp; or be contained in a CDATA section

See this link on how to escape XML strings in Objective-C

Upvotes: 6

Related Questions