user558802
user558802

Reputation: 51

GDataXML iOS Escaping & before parse

ASIHttpRequest gives me the responsedata of a REST request as an NSData object.

I pass this data object into:

GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:responseData
                                                       options:0
                                                         error:&error];

which produces these errors:

Entity: line 590: parser error : xmlParseEntityRef: no name Sales & Marketing ^ Entity: line 602: parser error : xmlParseEntityRef: no name Sales & Marketing

Research has shown me that this has to do with the fact that & needs to be replaced with "& amp;" before parsing.

But I just cannot find how to do this in a convenient way...

Upvotes: 1

Views: 795

Answers (1)

slycrel
slycrel

Reputation: 4285

try NSString's stringByReplacingString:withString: on the sending side, replacing @"&" with @"&". If you don't have control of the sending side then you may need to do some pre-processing of your returned data or a different way of parsing your XML.

Upvotes: 1

Related Questions