Unable to parse special characters using NSXMLParser
-
Hi All,
I'm having problems with NSXMLParser while parsing XML File which contain
some special characters or Non-UTF8 Characters,
My application will get the XML Document data from my server. I'm creating
the NSXMLParser with NSData received from Server. Some times it could be
possible that received NSData may contain special characters such as "Ã?" ,
then parser stops itself and returns an error saying Invalid Character
Found. Here is the Exact Error am receiving ---
*NSXMLParserErrorDomain error 9*
Please provide your valuable suggestions to solve the problem.
Thanks in Advance.
JanakiRam -
On Oct 16, 2008, at 11:23 AM, JanakiRam wrote:> I'm having problems with NSXMLParser while parsing XML File which
> contain
> some special characters or Non-UTF8 Characters,
Is the server setting the appropriate character encoding in the XML
document? If it is not, then the document is not well-formed, and
NSXMLParser is correctly rejecting it.
You can see what encoding is being used by examining the first line;
it will look something like
<?xml version='1.0' encoding='the-doc-encoding' ?>
--
Dave Carrigan
<dave...>
Seattle, WA, USA -
Dave,
Thanks for the response.
In this case we are getting the following as the first line of the document.
<?xml version="1.0"?>
JanakiRam
On Fri, Oct 17, 2008 at 12:11 AM, Dave Carrigan <dave...> wrote:>
> On Oct 16, 2008, at 11:23 AM, JanakiRam wrote:
>
> I'm having problems with NSXMLParser while parsing XML File which contain
>> some special characters or Non-UTF8 Characters,
>>
>
> Is the server setting the appropriate character encoding in the XML
> document? If it is not, then the document is not well-formed, and
> NSXMLParser is correctly rejecting it.
>
> You can see what encoding is being used by examining the first line; it
> will look something like
>
> <?xml version='1.0' encoding='the-doc-encoding' ?>
>
> --
> Dave Carrigan
> <dave...>
> Seattle, WA, USA
>
> -
On 16 Oct 2008, at 19:50:01, JanakiRam wrote:> Dave,
> Thanks for the response.
>
> In this case we are getting the following as the first line of the
> document.
>
> <?xml version="1.0"?>
>
> JanakiRam
Check the encoding of the file itself.
http://www.w3schools.com/XML/xml_encoding.asp


