NSXMLParser - encoding problems?
Hi,
I've been writing an app that interacts with a remote web service, and I've tried to parse a SOAP response.
I have stored the response as a data object, and then transfered it to a NSString before parsing it with NSXMLParser.
I replaced all < > & with <,>,&.
But the parser has been acting up, with a certain error: (NSXMLParserErrorDomain error 100.)
Here's my log:
2009-07-16 15:45:19.096 Bus[3656:20b] didstartElement call soap:Envelope
2009-07-16 15:45:19.097 Bus[3656:20b] didstartElement call soap:Body
2009-07-16 15:45:19.099 Bus[3656:20b] ERROR:Operation could not be completed. (NSXMLParserErrorDomain error 100.)
2009-07-16 15:45:19.099 Bus[3656:20b] didstartElement call loginResponse
2009-07-16 15:45:19.100 Bus[3656:20b] didstartElement call s-gensym3
2009-07-16 15:45:19.100 Bus[3656:20b] foundCharacters <
2009-07-16 15:45:19.101 Bus[3656:20b] foundCharacters root
2009-07-16 15:45:19.102 Bus[3656:20b] foundCharacters >
...
The parser cannot recognize <root> as an Element name!!! and returns it as three separate entities.
It does this for all of <root>'s child elements also!
I think this and the error have something to do with <, >, &,
even though I converted them to <>& in the NSString. The parser obviously still recognizes the ampersand, despite my replacing them. I think something is up with the encoding.
If anybody could advise me if there is a quick fix or something I could do to bypass this?
Thanks in advance.
|