NSXMLParser Error code:5, iphone

2019-08-23 22:20发布

问题:

When i try to parse an xml using nsxmlparser, this error code is showing up, what is this error code pointing to

回答1:

NSXMLParser reference, Parser Error Constants:

NSXMLParserPrematureDocumentEndError = 5
//The document ended unexpectedly.

You're likely trying to parse invalid xml document.



回答2:

I ran into the same issue. It turned out it was the encoding. I used the sign "€", which wasn't properly encoded.