Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5046] iOS: Problems parsing XMLs file

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-09-06T10:10:18.000+0000
Affected Version/sRelease 1.7.2
Fix Version/sSprint 2011-36
ComponentsiOS
Labelsios, xml, xmlparsing
ReporterEduardo Gomez
AssigneeVikramjeet Singh
Created2011-08-18T09:45:26.000+0000
Updated2011-09-13T16:56:32.000+0000

Description

Problem

On TiSDK 1.7.2 app crashes while parsing XML local file. If parsing is done with 1.8.0 app doesn't crash.

Tested on

iOS Simulator 4.3

Repro Sequence

var parser = function(xml) {
    var items = [];

    var nodes = xml.getElementsByTagName('m:properties');

    Ti.API.info(nodes.length + ' nodes found');
    for (var i = 0; i < nodes.length; i++) {
        Ti.API.info('parsing node '+ i);
        var item = {};

        item.MerchantLookupId = nodes.item(i).getElementsByTagName("d:MerchantLookupId").item(0).text;
        item.Latitude = nodes.item(i).getElementsByTagName("d:Latitude").item(0).text;
        item.Longitude = nodes.item(i).getElementsByTagName("d:Longitude").item(0).text;
        item.IsDefaultAddress = nodes.item(i).getElementsByTagName("d:IsDefaultAddress").item(0).text;
        item.Address = nodes.item(i).getElementsByTagName("d:Address").item(0).text;
        item.City = nodes.item(i).getElementsByTagName("d:City").item(0).text;
        item.StateProvince = nodes.item(i).getElementsByTagName("d:StateProvince").item(0).text;
        item.ZIPPostalCode = nodes.item(i).getElementsByTagName("d:ZIPPostalCode").item(0).text;
        item.PhoneNo = nodes.item(i).getElementsByTagName("d:PhoneNo").item(0).text;
        item.Id = nodes.item(i).getElementsByTagName("d:Id").item(0).text;

        items.push(item);
    }

    return items;
};
var myFile = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'Addresses.xml');
var contents = myFile.read();
Ti.API.info(myFile);

var xmlstr = contents.text;

var xml = Ti.XML.parseString(xmlstr);

parser(xml);

Console output

SDK 1.7.2 can't parse file - App does crash {noformat} [INFO] T10718/1.0 (1.7.2.97c3689) [DEBUG] Analytics is enabled = YES [DEBUG] loading: /Users/egomez/Documents/Titanium Studio Workspace/T10718/Resources/app.js, resource: Users/egomez/Documents/Titanium Studio Workspace/T10718/Resources/app_js [INFO] /Users/egomez/Documents/Titanium Studio Workspace/T10718/Resources/Addresses.xml [INFO] 156 nodes found [INFO] parsing node 0 [INFO] parsing node 1 [INFO] parsing node 2 [INFO] parsing node 3 [INFO] parsing node 4 [INFO] parsing node 5 [INFO] parsing node 6 [INFO] parsing node 7 [INFO] parsing node 8 [INFO] parsing node 9 [INFO] parsing node 10 [INFO] parsing node 11 [INFO] parsing node 12 [INFO] parsing node 13 [INFO] parsing node 14 [INFO] parsing node 15 [INFO] parsing node 16 [INFO] parsing node 17 [INFO] parsing node 18 [INFO] parsing node 19 [INFO] parsing node 20 [INFO] parsing node 21 [INFO] parsing node 22 [INFO] parsing node 23 [INFO] parsing node 24 [INFO] parsing node 25 [INFO] parsing node 26 [INFO] parsing node 27 [INFO] parsing node 28 [INFO] parsing node 29 [INFO] parsing node 30 [INFO] parsing node 31 [INFO] parsing node 32 [INFO] parsing node 33 [INFO] parsing node 34 [INFO] parsing node 35 [INFO] parsing node 36 [INFO] parsing node 37 [INFO] parsing node 38 [INFO] parsing node 39 [INFO] parsing node 40 [INFO] parsing node 41 [INFO] parsing node 42 [INFO] parsing node 43 [INFO] parsing node 44 [INFO] parsing node 45 [INFO] parsing node 46 [INFO] parsing node 47 [INFO] parsing node 48 [INFO] parsing node 49 [INFO] parsing node 50 [INFO] parsing node 51 [INFO] parsing node 52 [INFO] parsing node 53 [INFO] parsing node 54 [INFO] parsing node 55 [INFO] parsing node 56 [INFO] parsing node 57 [INFO] parsing node 58 [INFO] parsing node 59 [INFO] parsing node 60 [INFO] parsing node 61 [INFO] parsing node 62 [INFO] parsing node 63 [INFO] parsing node 64 [INFO] parsing node 65 [INFO] parsing node 66 [INFO] parsing node 67 [INFO] parsing node 68 [INFO] parsing node 69 [INFO] parsing node 70 [INFO] parsing node 71 [INFO] parsing node 72 [INFO] parsing node 73 [INFO] parsing node 74 [INFO] parsing node 75 [INFO] parsing node 76 [INFO] parsing node 77 [INFO] parsing node 78 [INFO] parsing node 79 [INFO] parsing node 80 [INFO] parsing node 81 [INFO] parsing node 82 [INFO] parsing node 83 [INFO] parsing node 84 [INFO] parsing node 85 [INFO] parsing node 86 [INFO] parsing node 87 [INFO] parsing node 88 [INFO] parsing node 89 [INFO] parsing node 90 [INFO] parsing node 91 [INFO] parsing node 92 [INFO] parsing node 93 [INFO] parsing node 94 [INFO] parsing node 95 [INFO] parsing node 96 [INFO] parsing node 97 [INFO] parsing node 98 [INFO] parsing node 99 [INFO] parsing node 100 [INFO] parsing node 101 [INFO] parsing node 102 [INFO] parsing node 103 [INFO] parsing node 104 [INFO] parsing node 105 [INFO] parsing node 106 [INFO] parsing node 107 [INFO] parsing node 108 [INFO] parsing node 109 [INFO] parsing node 110 [INFO] parsing node 111 [INFO] parsing node 112 [INFO] parsing node 113 [INFO] parsing node 114 [INFO] parsing node 115 [INFO] parsing node 116 [INFO] parsing node 117 [INFO] parsing node 118 [INFO] parsing node 119 [INFO] parsing node 120 [INFO] parsing node 121 [INFO] parsing node 122 [INFO] parsing node 123 [INFO] parsing node 124 [INFO] parsing node 125 [INFO] parsing node 126 [INFO] parsing node 127 [INFO] parsing node 128 [INFO] parsing node 129 [INFO] parsing node 130 [INFO] parsing node 131 [INFO] parsing node 132 [INFO] parsing node 133 [INFO] parsing node 134 [INFO] parsing node 135 [INFO] parsing node 136 [INFO] parsing node 137 [INFO] parsing node 138 [INFO] parsing node 139 [INFO] parsing node 140 [INFO] parsing node 141 [INFO] parsing node 142 [INFO] parsing node 143 [INFO] parsing node 144 [INFO] parsing node 145 [INFO] parsing node 146 [INFO] parsing node 147 [INFO] parsing node 148 [INFO] parsing node 149 [DEBUG] App Spec: specified by path /Users/egomez/Documents/Titanium Studio Workspace/T10718/build/iphone/build/Debug-iphonesimulator/T10718.app [DEBUG] SDK Root: path=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk version=4.3 name=Simulator - iOS 4.3 [DEBUG] using device family iphone [DEBUG] Session started [DEBUG] Session did end with error (null) [INFO] Application has exited from Simulator {noformat} SDK 1.8.0 parses file completely - App doesn't crash (156 nodes parsed correctly) {noformat} [INFO] Titanium SDK version: 1.8.0.v20110805142555 [INFO] iPhone Device family: universal [INFO] iPhone SDK version: 4.3 [INFO] iPhone simulated device: iphone [DEBUG] executing command: /usr/bin/killall iPhone Simulator [DEBUG] No matching processes belonging to you were found [DEBUG] finding old log files [DEBUG] executing command: mdfind -onlyin /Users/egomez/Library/Application Support/iPhone Simulator/4.3 -name 6ae9119c-e11d-4e9c-83c0-cb009814af5d.log [INFO] Launching application in Simulator [INFO] Launched application in Simulator (6.36 seconds) [DEBUG] executing command: xcodebuild -version [DEBUG] Xcode 4.0.2 [DEBUG] Build version 4A2002a [INFO] Found 4.3.2 patch installed [INFO] Application started [DEBUG] reading stylesheet from: /Users/egomez/Library/Application Support/iPhone Simulator/4.3.2/Applications/073352C5-4942-4741-B60D-F45DB38D3C14/T10718.app/stylesheet.plist [INFO] T10718/1.0 (1.8.0.v20110805142555.02da6d9...) [DEBUG] Analytics is enabled = YES [DEBUG] loading: /Users/egomez/Library/Application Support/iPhone Simulator/4.3.2/Applications/073352C5-4942-4741-B60D-F45DB38D3C14/T10718.app/app.js, resource: app_js [INFO] /Users/egomez/Library/Application Support/iPhone Simulator/4.3.2/Applications/073352C5-4942-4741-B60D-F45DB38D3C14/T10718.app/Addresses.xml [INFO] 156 nodes found [INFO] parsing node 0 [INFO] parsing node 1 [INFO] parsing node 2 [INFO] parsing node 3 [INFO] parsing node 4 [INFO] parsing node 5 [INFO] parsing node 6 [INFO] parsing node 7 [INFO] parsing node 8 [INFO] parsing node 9 [INFO] parsing node 10 [INFO] parsing node 11 [INFO] parsing node 12 [INFO] parsing node 13 [INFO] parsing node 14 [INFO] parsing node 15 [INFO] parsing node 16 [INFO] parsing node 17 [INFO] parsing node 18 [INFO] parsing node 19 [INFO] parsing node 20 [INFO] parsing node 21 [INFO] parsing node 22 [INFO] parsing node 23 [INFO] parsing node 24 [INFO] parsing node 25 [INFO] parsing node 26 [INFO] parsing node 27 [INFO] parsing node 28 [INFO] parsing node 29 [INFO] parsing node 30 [INFO] parsing node 31 [INFO] parsing node 32 [INFO] parsing node 33 [INFO] parsing node 34 [INFO] parsing node 35 [INFO] parsing node 36 [INFO] parsing node 37 [INFO] parsing node 38 [INFO] parsing node 39 [INFO] parsing node 40 [INFO] parsing node 41 [INFO] parsing node 42 [INFO] parsing node 43 [INFO] parsing node 44 [INFO] parsing node 45 [INFO] parsing node 46 [INFO] parsing node 47 [INFO] parsing node 48 [INFO] parsing node 49 [INFO] parsing node 50 [INFO] parsing node 51 [INFO] parsing node 52 [INFO] parsing node 53 [INFO] parsing node 54 [INFO] parsing node 55 [INFO] parsing node 56 [INFO] parsing node 57 [INFO] parsing node 58 [INFO] parsing node 59 [INFO] parsing node 60 [INFO] parsing node 61 [INFO] parsing node 62 [INFO] parsing node 63 [INFO] parsing node 64 [INFO] parsing node 65 [INFO] parsing node 66 [INFO] parsing node 67 [INFO] parsing node 68 [INFO] parsing node 69 [INFO] parsing node 70 [INFO] parsing node 71 [INFO] parsing node 72 [INFO] parsing node 73 [INFO] parsing node 74 [INFO] parsing node 75 [INFO] parsing node 76 [INFO] parsing node 77 [INFO] parsing node 78 [INFO] parsing node 79 [INFO] parsing node 80 [INFO] parsing node 81 [INFO] parsing node 82 [INFO] parsing node 83 [INFO] parsing node 84 [INFO] parsing node 85 [INFO] parsing node 86 [INFO] parsing node 87 [INFO] parsing node 88 [INFO] parsing node 89 [INFO] parsing node 90 [INFO] parsing node 91 [INFO] parsing node 92 [INFO] parsing node 93 [INFO] parsing node 94 [INFO] parsing node 95 [INFO] parsing node 96 [INFO] parsing node 97 [INFO] parsing node 98 [INFO] parsing node 99 [INFO] parsing node 100 [INFO] parsing node 101 [INFO] parsing node 102 [INFO] parsing node 103 [INFO] parsing node 104 [INFO] parsing node 105 [INFO] parsing node 106 [INFO] parsing node 107 [INFO] parsing node 108 [INFO] parsing node 109 [INFO] parsing node 110 [INFO] parsing node 111 [INFO] parsing node 112 [INFO] parsing node 113 [INFO] parsing node 114 [INFO] parsing node 115 [INFO] parsing node 116 [INFO] parsing node 117 [INFO] parsing node 118 [INFO] parsing node 119 [INFO] parsing node 120 [INFO] parsing node 121 [INFO] parsing node 122 [INFO] parsing node 123 [INFO] parsing node 124 [INFO] parsing node 125 [INFO] parsing node 126 [INFO] parsing node 127 [INFO] parsing node 128 [INFO] parsing node 129 [INFO] parsing node 130 [INFO] parsing node 131 [INFO] parsing node 132 [INFO] parsing node 133 [INFO] parsing node 134 [INFO] parsing node 135 [INFO] parsing node 136 [INFO] parsing node 137 [INFO] parsing node 138 [INFO] parsing node 139 [INFO] parsing node 140 [INFO] parsing node 141 [INFO] parsing node 142 [INFO] parsing node 143 [INFO] parsing node 144 [INFO] parsing node 145 [INFO] parsing node 146 [INFO] parsing node 147 [INFO] parsing node 148 [INFO] parsing node 149 [INFO] parsing node 150 [INFO] parsing node 151 [INFO] parsing node 152 [INFO] parsing node 153 [INFO] parsing node 154 [INFO] parsing node 155 [DEBUG] application booted in 424.836993 ms Terminating in response to SpringBoard's termination. {noformat}

Associated HD ticket

ENT customer relying on this, http://appc.me/c/APP-163199

Additional info

"Addresses.xml" file to be read is attached. Let me know please if anymore info is needed, thanks.

Attachments

FileDateSize
Addresses.xml2011-08-18T09:45:26.000+0000383419

Comments

  1. Don Thorp 2011-09-06

    CE says this is resolved fixed.
  2. Vikramjeet Singh 2011-09-13

    Resolved. Tested On: Mac OSX Lion TiMob: 1.8.0.v20110906155354 TiStud: 1.0.5.201109091616 Devices Used: iPhone Simulator 4.3 iPod 3G version 4.0.2 iPhone4 version 4.3.4

JSON Source