Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8866] Android: XML parse throws an error getDocumentElement() has no method getElementsByTagName

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionInvalid
Resolution Date2012-04-27T04:26:29.000+0000
Affected Version/sRelease 1.8.3
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterRadamantis Torres-Lechuga
AssigneePing Wang
Created2012-04-23T15:44:28.000+0000
Updated2017-03-24T18:11:06.000+0000

Description

Actual Behavior

On XML parse, using the "getElementsByTagName" android throws an error:
Uncaught TypeError: Object function getDocumentElement() {[native code]}

Expected Behavior

To parse the XML successfully , just as on iOS

Test Case

request = Ti.Network.createHTTPClient({ timeout:9000 });

request.onload = function() {
	var content = this.responseXML.getDocumentElement.getElementsByTagName("smart-phones").item(0);
	Ti.API.error('content: '+content);
	var upfrontContent = {
		title:content.getElementsByTagName("promote-title").item(0).text,
		img: content.getElementsByTagName("promote-image-url").item(0).text,
		desc: content.getElementsByTagName("promote-desc").item(0).text,
		pdf: content.getElementsByTagName("download-url").item(0).text 
	};
	Ti.API.error('upfrontContent things: title: '+upfrontContent.title+' img:'+upfrontContent.img+' desc:'+upfrontContent.desc);						
};
request.onerror = function() {					
	Ti.API.error('ERROR!!!');
};
	request.open('GET', URL);
	request.send(null);

Comments

  1. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source