vikas
vikas

Reputation: 817

NSXMLParser Error

I am using NSXMLParser to parse the html file on the server side.(using iphone sdk 3.0) and my parser stop parsing after it encounter any error and call the delegate message

My Ques:How can I parse the file after it encounter the error.Is there any way to do so.

Thanks

Upvotes: 0

Views: 808

Answers (2)

Epsilon Prime
Epsilon Prime

Reputation: 4586

You're looking for a different kind of parser. An "at-all-costs" parser would be able to do what you want. If you are getting XML from lots of different sources this is ideal.

If you have a few sources you can workaround their problems. For instance, if the only issue you get is that they told you it was UTF-8 when it turns out it is ISO-8859-1 you could run through it once, find out it fails due to a character issue, convert the XML from ISO-8859-1 to UTF-8 and try again. Since you know where the error was you can try to make some sort of fix. It's quite expensive to go this route though.

Upvotes: 0

user23743
user23743

Reputation:

You can't. Parsing is stopped when the error is encountered. It would be hard to know what the rest of an erroneous XML document meant, anyway, as the meaning of anything at one location in the document depends on everything that came before it (in this case, including an error).

Upvotes: 2

Related Questions