【Bug记录】Anroid解析xml 出现unexpected token错误
来源:互联网 发布:微商必备软件 编辑:程序博客网 时间:2024/06/05 19:05
现象:Android使用XmlPullParser解析xml输入流出现unexpected token错误
原因:使用的xml文件放在res中,使用getResources().openRawResource(R.xml.XXX)获取输入流,解析出现错误;后改将xml放在assets中,换用getResources().getAssets().open("xxx.xml")方法获取stream,问题解决。
分析:百度到一分析:
Where do you store your xml file? In "res" folder. You should store it in "assets". Res-solution is not working because of specific of the "res" folder and it's presentation in the apk. Move your file to the "assets" and you'll see that everything is working. Use the following code for creating InputSource:
getAssets().open("yourfilename.xml")
0 0
- 【Bug记录】Anroid解析xml 出现unexpected token错误
- 在进行xml解析时,出现XmlPullParserException:Unexpected token(position:unknown @2:1错误
- 记录js错误:Uncaught SyntaxError: Unexpected token <
- js出现的错误unexpected token
- 错误:QuerySyntaxException: unexpected token;
- 解决Ajax请求出现Uncaught SyntaxError: Unexpected token : 错误
- ajaxfileupload上传文件出现SyntaxError:unexpected token <错误
- xml解析错误记录
- SyntaxError:Unexpected token < 错误解决方法
- 错误:Uncaught SyntaxError: Unexpected token <
- 错误:Uncaught SyntaxError: Unexpected token }
- ajaxFileUpload.js 修复"unexpected token '<'" bug
- 安装phpbb3论坛中文语言包 出现的-bash: syntax error near unexpected token `('错误
- 编译内核出现错误提示:line 0:syntax error near unexpected token '('
- linux下source bashrc出现synctax error near unexpected token 的错误
- 使用dojo框架出现错误"SyntaxError: Unexpected token <"中的一种解决方法
- Struts2中,使用JQuery下的AJAX出现的“unexpected token <”错误
- node.js在执行js文件时出现SystaxError:Unexpected token LILEGAL的错误
- JAVA集合之——Comparable和Comparator
- iOS UILabel多行时文字向下偏移
- C++ Keywords: typedef
- [精华]Hadoop,HBase分布式集群和solr环境搭建
- 在ubuntu下用apt-get安装和管理java
- 【Bug记录】Anroid解析xml 出现unexpected token错误
- 二阶压控低通滤波器设计过程中的一点疑问
- 在与SQLServer建立连接时出现与网络相关的或特定于实例的错误
- [leetcode] Search Insert Position
- Maven搭建SpringMVC+Hibernate项目详解
- Android 5.0十大新特性
- 新第二天
- UI--Android中的状态切换按钮自定义
- fragment的注意事项