{ "id": "64097", "key": "TIMOB-3465", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11362", "description": "Mobile 1.8.0 M09", "name": "Sprint 2011-30", "archived": true, "released": true, "releaseDate": "2011-08-01" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-07-27T09:22:59.000+0000", "created": "2011-04-15T03:45:31.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "reported-1.6.1", "tooling", "xml" ], "versions": [ { "id": "11260", "description": "", "name": "Release 1.6.2", "archived": true, "released": true, "releaseDate": "2011-04-20" } ], "issuelinks": [], "assignee": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-08-26T16:15:19.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

On Android, If parseString is only defined inside an event\r\nlistener then you will get an error.

\r\n

Note

\r\n

This only happens until you define it outside of the\r\neventListener once. After that it will work fine in that\r\napplication even if it is inside an event listener. In order to\r\nreproduce this error you MUST create a new application.

\r\n

Step 1: Create a NEW application
\r\nStep 2: Paste the example below into app.js
\r\nStep 3: Run the app
\r\nStep 4: Click 'Find Foo'
\r\nStep 5: Notice Runtime Error (picture of error attached)

\r\n
\r\nvar xmlString = '<items><foo>FOO</foo><bar>BAR</bar></items>';\r\n\r\nvar window = Ti.UI.createWindow({\r\n    backgroundColor: 'green'\r\n});\r\n\r\nvar button = Ti.UI.createButton({\r\n    title: 'Find Foo',\r\n    height: 60,\r\n    width: 100,\r\n  top: 40\r\n});\r\nbutton.addEventListener('click', function(e){\r\n    var xml = Titanium.XML.parseString(xmlString);\r\n  var element = xml.getElementsByTagName(\"foo\");\r\n  Ti.API.info( element.item(0).text );\r\n});\r\n\r\nwindow.add(button);\r\nwindow.open();\r\n
\r\n

Tested on

\r\n

TiSDK 1.6.1, Android SDK 2.1

{html}", "attachment": [ { "id": "18325", "filename": "error.jpg", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:45:31.000+0000", "size": 81012, "mimeType": "image/jpeg" } ], "flagged": false, "summary": "Android: XML Cannot call method parseString if only defined inside an event listener", "creator": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "160506", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "pull request ready https://github.com/appcelerator/titanium_mobile/pull/276", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-07-25T14:14:53.000+0000", "updated": "2011-07-25T14:14:53.000+0000" }, { "id": "160513", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "XML module was not being included in build because:\r\n\r\na) It has an all upper case name, which means it was being treated as a constant rather than a module.\r\nb) No other module outside of Network had a dependency on it, and only Yahoo has a dependency on Network, so it was easy for XML to be avoided given (a) above.", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-07-25T14:27:32.000+0000", "updated": "2011-07-25T14:27:32.000+0000" }, { "id": "160731", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reviewed and tested.", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-07-27T09:22:59.000+0000", "updated": "2011-07-27T09:22:59.000+0000" }, { "id": "164219", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.8.0.v20110819142548 on\nMotorola Xoom 3.2\nDroid 1 2.2.2", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-08-26T16:15:19.000+0000", "updated": "2011-08-26T16:15:19.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }