Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7041] iOS: getAttribute value from XML does not work in 1.8.0.1

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-03-20T18:12:27.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterFrancisco Antonio Duran Ramirez
AssigneeStephen Tramer
Created2012-01-09T15:40:16.000+0000
Updated2017-03-13T17:59:20.000+0000

Description

Problem

GetAttribute value from XML does not work in 1.8.0.1

Reproducible steps:

1. Run the code below with 1.8.0.1 Titanium SDK. Please see the 1.8.0.1 attached image. 2. Run the the code below with 1.7.5 Titanium SDK. Please see the 1.7.5 attached image. Notice that in 1.7.5 Titanium SDK the the value is displayed on the window.

Expected behavior:

Customer wants to have the same behavior in 1.8.0.1 Titanium SDK.

Tested with the next specs:

Simulator iPhone 4 Version of the device: 5.0.1 Titanium Studio, build: 1.0.8.201112291658 Titanium SDK: 1.8.0.1 & 1.7.5

Console Logs:

1.8.0.1 Titanium SDK.[INFO] One moment, building ...[INFO] Titanium SDK version: 1.8.0.1 (12/22/11 13:09 fbdc96f)[INFO] iPhone Device family: universal
[INFO] iPhone SDK version: 5.0[INFO] iPhone simulated device: iphone
[INFO] Launching application in Simulator
[INFO] Launched application in Simulator (1.71 seconds)[INFO] Found 5.0 patch installed
[INFO] Application started
[INFO] v1.8 Demo/1.0 (1.8.0.1.fbdc96f)[INFO] Loaded
[INFO] [object TiDOMNodeList][INFO] 0[INFO] 26
1.7.5 Titanium SDK

[INFO] One moment, building ...[INFO] Titanium SDK version: 1.7.5[INFO] iPhone Device family: universal
[INFO] iPhone SDK version: 5.0[INFO] iPhone simulated device: iphone
[INFO] Launching application in Simulator
[INFO] Launched application in Simulator (1.30 seconds)[INFO] Found 5.0 patch installed
[INFO] Application started
[INFO] v1.8 Demo/1.0 (1.7.5.ab20af7)[INFO] Loaded
[INFO] [object TiDOMNodeList][INFO] 1[INFO] 26

Code:

{Code} var win1 = Titanium.UI.createWindow({ title: 'Tab 1', backgroundColor: '#fff'}); var label1 = Titanium.UI.createLabel({ color: '#999', text: '', font: { fontSize: 20, fontFamily: 'Helvetica Neue' }, textAlign: 'center', width: 'auto'});win1.add(label1); var xhr = Titanium.Network.createHTTPClient(); xhr.onerror = function(e) { Ti.API.error('Error received while requesting library data: ' + JSON.stringify(e)); }; xhr.onload = function() { if (this.readyState == 4) { var xmldoc = this.responseXML.documentElement; Ti.API.info('Loaded'); Ti.API.info(xmldoc.getElementsByTagName('archive')); //This line of code says that the archive tag is detected Ti.API.info(xmldoc.getElementsByTagName('archive').length); // this line says that it recieves an archive tag with no nodes Ti.API.info(xmldoc.getElementsByTagName('media').length); // this line says it recieves 26 nodes for "media" tag which is a child of "archive" tag label1.text = 'XML Version : ' + xmldoc.getElementsByTagName('archive').item(0).getAttribute('version'); }}; xhr.open('GET', 'http://apps.investis.com/Kingfisher-IR/Library.xml'); xhr.send(); win1.open(); {Code}

Helpdesk

APP-697182

Attachments

FileDateSize
1.7.5.png2012-01-09T15:40:16.000+0000119983
1.8.0.1.png2012-01-09T15:40:16.000+0000117250

Comments

  1. Blain Hamon 2012-03-13

    Pull #1655
  2. Wilson Luu 2012-03-15

    Closing bug. Verified fix on: SDK build: 2.0.0.v20120315123246 Titanium Studio, build: 2.0.0.201203142055 xcode: 4.2 Device: iphone 4s (5.0.1)
  3. Stephen Tramer 2012-03-20

    The problem described in the source code is incorrect. XML in versions prior to 1.8.0 did NOT have the correct behavior; the new behavior is correct. The JS source makes assumptions based on this previously incorrect behavior. See the DOM Level 2 spec for information about how getElementsByTagName should behave: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-745549614 The original "fix" for this issue has been removed in favor of the correct behavior, in order to resolve TIMOB-8135.
  4. Lee Morris 2017-03-13

    Closing ticket as invalid.

JSON Source