钛的Andr​​oid截断XHR XML响应 [英] Titanium Android truncates XHR XML response

查看:149
本文介绍了钛的Andr​​oid截断XHR XML响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是从重构的iOS应用程序与钛Appecelerator(SDK版本:3.3.0.GA,IDE版本:3.2.0.201312191547)到Android。
当涉及到消费的XML响应XHR,Android的失败:

I'm refactoring an app from iOs to Android with Titanium Appecelerator (SDK version: 3.3.0.GA, IDE version:3.2.0.201312191547). When it comes to consume an XML XHR response, Android fails:

var memoxhrRequest = Titanium.Network.createHTTPClient();
memoxhrRequest.onload = function() {
Ti.API.info('Elenco richieste inviate (text) = ' + this.responseText);
memoxhrRequest = null;
var xml = Ti.XML.parseString(this.responseText.trim());
elementi = xml.documentElement.getElementsByTagName("text").item(0).getElementsByTagName("requestlist").item(0).getElementsByTagName("request");
    Ti.API.info('elementi.item.length : ' + elementi.item.length);

ELEMENTI'是响应内部XML节点的数目。
而在iPhone everythhing的精细,在Android的响应被截断,结束了非有效的XML文档中的

'elementi' is the number of XML nodes inside the response. While in iPhone everythhing's fine, in Android the response gets truncated, ending in a non valid XML document.

我试图增加threadSpace在这个维基条目:
https://developer.appcelerator.com/question/134980/android-truncating-xhr-response
,但没有发生的事情。

I tried to increase the threadSpace as in this wiki entry: https://developer.appcelerator.com/question/134980/android-truncating-xhr-response , but nothing's happened.

你们任何人有一个解决方案?

Any of you has a solution?

推荐答案

更改:

var xml =Ti.XML.parseString(this.responseText.trim()); 

var xml = this.responseXML;

解决了这个问题。

Solved this issue.

钛恰好是少得多tollerant Android开发方面,而不是FO的iOS ...

Titanium happens to be much less tollerant when developing for Android rather than fo iOS...

这篇关于钛的Andr​​oid截断XHR XML响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆