解析xml时,报错:WARN/System.err(207): org.apache.harmony.xml.ExpatParser$ParseException: At line 1,
来源:互联网 发布:装修监理 知乎 编辑:程序博客网 时间:2024/05/16 05:44
最近两天看mars老师的mp3播放器,一步一步跟着老师敲的代码,结果运行起来,解析xml时总是报错
private List<Mp3Info> parseXML(String xmlStr){SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();List<Mp3Info> infos = new ArrayList<Mp3Info>();try{XMLReader xmlReader = saxParserFactory.newSAXParser().getXMLReader();Mp3ContentHandler mp3ListContentHandler = new Mp3ContentHandler(infos);xmlReader.setContentHandler(mp3ListContentHandler);xmlReader.parse(new InputSource(new StringReader(xmlStr)));for (Iterator<Mp3Info> iterator = infos.iterator(); iterator.hasNext();) {Mp3Info mp3Info = (Mp3Info) iterator.next();System.out.println(mp3Info);}}catch(Exception e){e.printStackTrace();}return infos;}这个方法是对下载的xml文件的简析但是这句xmlReader.parse(new InputSource(new StringReader(xmlStr)));执行不了String xml = downloadXML("http://192.168.136.125:8080/mp3/resouces.xml");System.out.println(xml);parseXML(xml);这段代码是调用上面的方法System.out.println(xml);这个可以输出得到的xml文本xmlReader.parse(new InputSource(new StringReader(xmlStr)));就这句执行了不了折腾了好长时间,都快怒砸本了!!
无奈中查看了一下服务器中的xml文件,发现xml的定义中有个下错误
希望碰到此类问题的朋友能早点解决
0 0
- 解析xml时,报错:WARN/System.err(207): org.apache.harmony.xml.ExpatParser$ParseException: At line 1,
- 解析xml时,报错:org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 75:not well-formed
- 解析xml时,报错:org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 4:not well-formed(invaild toke)
- 解析XML时,org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 449: not well-forme
- org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: unknown encoding
- org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: unknown encoding
- org.apache.harmony.xml.ExpatParser$ParseException mismatched tag
- android用SAX解析xml文件时抛出org.apache.harmony.xml.ExpatParser$ParseException异常的解决方法
- Android开发时出现org.apache.harmony.xml.ExpatParser$ParseException:not well-formed错误时,我所犯的错误
- jboss启动报org.jboss.security.auth.login.ParseException: Encountered "<?xml" at line 1, column 1. 异常
- android SAX解析xml流时报ExpatParser$ParseException错误解决方法
- org.apache.lucene.queryParser.ParseException: Encountered "<EOF>" at line 1, column 0.
- org.apache.lucene.queryParser.ParseException: Encountered "<EOF>" at line 1, column 0.
- org.apache.lucene.queryparser.classic.ParseException: Encountered "<EOF>" at line 1, column 0.
- ognl.ExpressionSyntaxException: Malformed OGNL expression: <?xml version [ognl.ParseException: Encountered " <" at line 1, colum
- org.apache.el.parser.ParseException: Encountered " ":" ": "" at line 1, column 1
- Pull解析XML时出现System.err: org.xmlpull.v1.XmlPullParserException: Expected a quoted string (position:DO
- 报错:org.apache.xml.utils.PrefixResolver
- Mahout安装与测试-基于hadoop单结点伪分布式
- 正则表达式-贪婪与非贪婪匹配
- get请求中文乱码
- git修改服务器上前一个提交未merge的代码片段
- Lucene的中文分词器IKAnalyzer
- 解析xml时,报错:WARN/System.err(207): org.apache.harmony.xml.ExpatParser$ParseException: At line 1,
- QT数据序列化转载及修正----我们考虑的内容科学家已经考虑过了
- lucene--分词器的分析
- jsp中页面传值
- 位图
- Maximum Subarray
- asp.net 使用 cookie 保存密码
- 恶汉式和懒汉式
- IOS银联支付的流程