xmlCtxtGetLastError - iPhone

发布于 2024-08-25 04:55:09 字数 358 浏览 4 评论 0原文

我使用 NSXMLParser 编程已经有一段时间了,最​​近,我遇到了这个错误。最奇怪的是它只发生在调试模式下。一旦我在模拟器中加载应用程序并从模拟器运行它(不涉及 Xcode),它就可以正常运行。

代码非常简单,它是一个简单的 XML 解析,其内容是在单独的线程中从 Web 加载的。

有人已经遇到过这个错误吗?

提前致谢。

编辑:

我及时意识到当 XML 文档格式错误时会发生此错误。就我而言,我提取了 HTML 页面的一些内容并解析生成的字符串,但该字符串的格式并不总是正确的。稍微修改一下...

确保您的文档在解析时格式良好,否则您可能会遇到同样的错误... PS:解析器错误方法没有捕获此错误。

I have been programming with NSXMLParser for quite a while and lately, I came out with this error. The strangiest thing is that it only happens in debug mode. Once I load the App in Simulator and run it from Simulator (without Xcode involved), it runs fine.

The code is very straight foward, it is a simple XML parsing whose contents were loaded from the web in a separated thread.

Does anybody have alredy encoutered that error??

Thanks in advance.

EDIT:

In time I realized that this error occur when you have a bad formated XML Document. In my case, I was extracting some of the contents of an HTML Page and parsing the resulting string, but this string was not allways well formed. A little modification an voilá...

Ensure that your documents are well formed when parsing or you may have the same mistake...
PS: The parser error method did not catch this error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

西瓜 2024-09-01 04:55:09

我及时意识到,当 XML 文档格式错误时,就会发生此错误。就我而言,我提取了 HTML 页面的一些内容并解析生成的字符串,但该字符串的格式并不总是正确的。稍微修改一下...

确保您的文档在解析时格式良好,否则您可能会遇到同样的错误... PS:解析器错误方法没有捕获此错误。

In time I realized that this error occur when you have a bad formated XML Document. In my case, I was extracting some of the contents of an HTML Page and parsing the resulting string, but this string was not allways well formed. A little modification an voilá...

Ensure that your documents are well formed when parsing or you may have the same mistake... PS: The parser error method did not catch this error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文