2011-11-17 65 views
1

Appcelerator的Q &的链接: XML Parsing failure on Android but works on iPhoneXML解析故障在Android,但适用于iPhone

我准备这既为iPhone和Android手机使用相同的代码,其钛是majorly用于工作的一般应用。使用相同的代码,我发现XML文档解析的结果不同,而我的android应用程序无法正确加载它。它会导致NULLPointer异常。但是相同的代码在iPhone上完美运行。

你可以检查吗?

xyz(languageCode, currentVersion, xmldoc) { 
try { 
    Ti.API.info('Start parsing the library'); 
    var archiveData = xmldoc.getElementsByTagName('archive'); 
    Ti.API.info('Archive: ' + archiveData); 
    Ti.API.info('Item: ' + archiveData.item); 
    Ti.API.info('Lendth: ' + archiveData.length); 
    var newVersion = archiveData.item(0).getAttribute('version'); 
}catch(e){ 
    Ti.API.info('Library Went In Catch: ' + e); 
} 

函数调用:Ti.Network.HttpClient

XYZ(语言代码,版本,this.responseXML.documentElement)的这是一个从有载()方法;

输出iPhone的:

存档:[对象TiDOMNodeList]

[INFO]项目:[对象TiDOMNodeList]

[INFO] Lendth:1

Android输出:

[INFO] [3,7225]存档:[Ti.NodeList]

[INFO] [1,7226]项目:[KrollMethod项目]

[INFO] [2,7228] Lendth: 0 [INFO]

[235,7466]图书馆进去抓:JavaException:显示java.lang.NullPointerException:空

回答