NSXMLparser 错误代码 5

问题描述:

我在我的应用中使用 Amazon 的 simpledb.解析 xml 时,它给出了代码 5 的错误.IE.NSXMLParserErrorDomain 错误 5.

I'm using Amazon's simpledb in my app. When parsing xml it gives an error with the code 5. ie. NSXMLParserErrorDomain error 5.

有时它工作正常并且导航没有任何显着变化会导致该错误.当我多次重新启动应用程序而不对系统中的代码或导航进行任何更改时,它再次正常工作.我无法弄清楚发生这种情况的原因.

Sometimes it works fine and without any significant change in the navigation is gives that error. Again it works fine when i restart the app several times without doing any changes to the code or navigation in the system. I cant figure out the reason why this happens.

谢谢

调试 101:查看标题以了解错误的含义.

Debugging 101: look at the headers to find what errors mean.

如果你查看 NSXMLParser.h,你会看到错误 5 是 NSXMLParserPrematureDocumentEndError.

If you look at NSXMLParser.h, you will see that error 5 is NSXMLParserPrematureDocumentEndError.

我认为可以肯定地说 XML 文档不完整.你是如何加载文档的?您是否确保在解析之前加载整个文档?

I think it's safe to say that the XML document is not complete. How are you loading the document? Are you ensuring that you load the whole document before parsing it?