weixin_33688840 2010-06-05 09:45 采纳率: 0%
浏览 24

BlackBerry responseXML为null

I'm trying to port a portion of AJAX code I wrote over to the BlackBerry application's embedded browser. Our base build is 4.6.1 and the RIM documentation claims that XMLHttpRequest's responseXML is available starting with this version. And when I request an XML file from my local server, I get back the responseText (so I know the request is working), but the responseXML is always null. I've made sure the HTTP "Content-Type" header is set to "text/xml" and I am getting the correct data loaded in a web browser. It's just nulling out in the BB web environment. Does anyone know what might be happening?

A backup of using the responseText and piping it through DOMParser is not possible because that object was not added to the BB browser until 4.7.1. So I'm not sure what fallback I have.

  • 写回答

1条回答 默认 最新

  • weixin_33737774 2010-06-05 15:09
    关注

    Answering my own question... Hopefully I can save someone else a few hours of frustration.

    1. Unfortunately, one of the files that I thought was returning with a content-type of text/xml was really coming back as text/html. I missed that. BB correctly does not try to parse something it thinks isn't xml. So on this point, I'm an idiot.

    2. Several of my files were composed of empty, self-closing root-node tags (example below). I don't know for sure if this is valid or not, but all other browsers I've tested this code on worked fine. But on the BB, the XML stream below resulted in a null responseXML:

      <?xml version="1.0" ?><rootnode />

    I'd delete my question, but I think point number 2 should be a surprise to most developers I know.

    评论

报告相同问题?

悬赏问题

  • ¥20 蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏