在平板电脑上,但不是仿真机器人解析错误 [英] android parsing error on tablet but not emulator
本文介绍了在平板电脑上,但不是仿真机器人解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的例外:
org.xml.saxParseException:意外的标记(位置TEXT @ 1:2 ...)
但它仅在平板电脑上运行我.apk文件时造成的。当被解析的Android模拟器相同的数据永远不会导致此异常及工程100%。任何想法?
这里的code抛出异常:
的DocumentBuilderFactory DBF = DocumentBuilderFactory.newInstance();
DocumentBuilder的DB = dbf.newDocumentBuilder();
的InputSource的InputSource =新的InputSource();
inputSource.setCharacterStream(新StringReader(XMLDATA));
文档DOC = db.parse(InputSource的);
这里是一部分从文件:
<结果> <结果标题=08 07 2011><现场标题=等等等等的价值=等等等等/> < /结果>< /结果>
解决方案
默认字符集不同,也许?请问XML有一个字符集的呢?
I have this exception:
org.xml.saxParseException: Unexpected token (position TEXT@1:2...)
but it is caused only when running my .apk on a tablet pc. The same data when is parsed on the android emulator never causes this exception and works 100%. Any ideas?
Here's the code that throws the exception:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource inputSource = new InputSource();
inputSource.setCharacterStream(new StringReader(xmlData));
Document doc = db.parse(inputSource);
And here is a part from the file:
<Results> <Result title="08 07 2011"><Field title="blah blah" value="blah blah" /> </Result></Results>
解决方案
Default charset differs, maybe? Does the XML have a charset in it?
这篇关于在平板电脑上,但不是仿真机器人解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文