开发者

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
                                      开发者_JAVA技巧                 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...


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜