xmlCtxtGetLastError - iPhone
我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我及时意识到,当 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.