Android dom解析器错误:PI不能以xml开头
我尝试读取服务url,它是xml格式的。当我试图解析这个xml时,我得到了一个错误:我搜索了这个,xml起始头标记的问题,即 我的xml从logcat输出:Android dom解析器错误:PI不能以xml开头,android,dom,xml-parsing,Android,Dom,Xml Parsing,我尝试读取服务url,它是xml格式的。当我试图解析这个xml时,我得到了一个错误:我搜索了这个,xml起始头标记的问题,即 我的xml从logcat输出: 09-25 09:09:37.134: I/System.out(408): <?xml version="1.0" encoding="UTF-8"?> 09-25 09:09:37.144: I/System.out(408): <ad2app> 09-25 09:09:37.144: I/System.o
09-25 09:09:37.134: I/System.out(408): <?xml version="1.0" encoding="UTF-8"?>
09-25 09:09:37.144: I/System.out(408): <ad2app>
09-25 09:09:37.144: I/System.out(408): <mob_interstitial>
09-25 09:09:37.154: I/System.out(408): <size>
09-25 09:09:37.154: I/System.out(408): <dimension>pixel</dimension>
09-25 09:09:37.154: I/System.out(408): <width>320</width>
09-25 09:09:37.154: I/System.out(408): <height>416</height>
09-25 09:09:37.154: I/System.out(408): </size>
09-25 09:09:37.154: I/System.out(408): <duration>
09-25 09:09:37.154: I/System.out(408): <dimension>seconds</dimension>
09-25 09:09:37.154: I/System.out(408): <d_number>5</d_number>
09-25 09:09:37.154: I/System.out(408): </duration>
09-2509:09:37.134:I/System.out(408):ï»
09-25 09:09:37.144:I/System.out(408):
09-25 09:09:37.144:I/System.out(408):
09-25 09:09:37.154:I/System.out(408):
09-25 09:09:37.154:I/System.out(408):像素
09-2509:09:37.154:I/System.out(408):320
09-2509:09:37.154:I/System.out(408):416
09-25 09:09:37.154:I/System.out(408):
09-25 09:09:37.154:I/System.out(408):
09-25 09:09:37.154:I/System.out(408):秒
09-2509:09:37.154:I/System.out(408):5
09-25 09:09:37.154:I/System.out(408):
从上面输出,添加了不必要的符号。像这样:i»
现在,如何从xml中删除不必要的符号来解决这个问题。
任何帮助…?问题已解决:我对xml字符串使用了替换方法。 i、 e:
String noHTMLString=xml.replaceAll(“ï»?,”)代码>