【问题标题】:dom Parser Error: PI must not start with xmldom 解析器错误:PI 不能以 xml 开头
【发布时间】:2012-09-25 03:55:28
【问题描述】:

我试图读取服务 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.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>

从上面输出,添加了不必要的符号。像这样:&lt;?xml version="1.0" encoding="UTF-8"?&gt;

现在,我怎样才能从我的 xml 中删除不必要的符号来解决这个问题。 有什么帮助...??

【问题讨论】:

    标签: android dom xml-parsing


    【解决方案1】:

    问题已解决:我对 xml 字符串使用了替换方法。 即:String noHTMLString = xml.replaceAll("","");

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-16
      • 2014-09-17
      • 2013-04-06
      • 1970-01-01
      • 1970-01-01
      • 2013-07-24
      • 1970-01-01
      • 2014-02-19
      相关资源
      最近更新 更多