{ "id": "91212", "key": "TIMOB-8953", "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": "13273", "description": "Release 2.0.2", "name": "Release 2.0.2", "archived": false, "released": true, "releaseDate": "2012-05-31" }, { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13406", "description": "Sprint 2012-10 API", "name": "Sprint 2012-10 API", "archived": true, "released": true, "releaseDate": "2012-05-20" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-05-18T21:12:40.000+0000", "created": "2012-05-02T12:09:21.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "api", "module_xml", "qe-testadded" ], "versions": [ { "id": "13272", "description": "Release 2.0.1", "name": "Release 2.0.1", "archived": true, "released": true, "releaseDate": "2012-04-16" } ], "issuelinks": [ { "id": "17013", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "91211", "key": "TIMOB-8952", "fields": { "summary": "iOS XML: appendChild Removes Namespace and Over Validation", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-07-05T15:02:57.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": "h1. Problem\r\nThere are a couple bugs preventing proper XML generation in Titanium. These are demonstrated in the reproduction below.\r\n\r\n1. Defining a namespace attribute for a document element ends up redefining \"xmlns\", which kills most XML interpreters because it's an illegal redefinition. (For example, I want to add an xmlns:m attribute to my doc, but it ends up redefining xmlns:n0=\"http://www.w3.org/2000/xmlns/\" and adding n0:m=\"myurl\".)\r\n2. Prefix names are ignored. In the example, \"atom:\" is renamed to \"n0:\", \"xmlns:\" to \"n1:\", \"d:\" to \"n2:\", and \"m:\" to \"n3\".\r\n3. Existing namespace definitions are ignored, in favor of defining the namespace on every child that specifies it. This shows up in the example for the properties and message elements receiving the new prefix \"n2\" and \"n3\", respectively.\r\n\r\nh2. Reproduction\r\n{code:title=app.js}\r\n(function (document, Ti) {\r\n document = document || Ti && Ti.XML.parseString('');\r\n var feed = document.implementation.createDocument('http://www.w3.org/2005/Atom', 'atom:feed', null);\r\n feed.documentElement.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:atom', 'http://www.w3.org/2005/Atom');\r\n feed.documentElement.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:m', 'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata');\r\n feed.documentElement.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:d', 'http://schemas.microsoft.com/ado/2007/08/dataservices');\r\n\r\n var id = feed.documentElement.ownerDocument.createElementNS('http://www.w3.org/2005/Atom', 'atom:id');\r\n id.appendChild(feed.documentElement.ownerDocument.createTextNode('http://appc.me/odata/flocker/4f9f037df04d4613dc0607d7'));\r\n feed.documentElement.appendChild(id);\r\n\r\n var title = feed.documentElement.ownerDocument.createElementNS('http://www.w3.org/2005/Atom', 'atom:title');\r\n title.appendChild(feed.documentElement.ownerDocument.createTextNode('4f9f037df04d4613dc0607d7'));\r\n feed.documentElement.appendChild(title);\r\n\r\n var entry = feed.documentElement.ownerDocument.createElementNS('http://www.w3.org/2005/Atom', 'atom:entry');\r\n var content = feed.documentElement.ownerDocument.createElementNS('http://www.w3.org/2005/Atom', 'atom:content');\r\n content.setAttribute('type', 'application/xml');\r\n var properties = feed.documentElement.ownerDocument.createElementNS('http://schemas.microsoft.com/ado/2007/08/dataservices/metadata', 'm:properties');\r\n\r\n var message = feed.documentElement.ownerDocument.createElementNS('http://schemas.microsoft.com/ado/2007/08/dataservices', 'd:message');\r\n message.appendChild(feed.documentElement.ownerDocument.createTextNode('This is a flock!'));\r\n properties.appendChild(message);\r\n\r\n content.appendChild(properties);\r\n entry.appendChild(content);\r\n feed.documentElement.appendChild(entry);\r\n\r\n var expected = '\\\r\n \\\r\n http://appc.me/odata/flocker/4f9f037df04d4613dc0607d7\\\r\n 4f9f037df04d4613dc0607d7\\\r\n \\\r\n \\\r\n \\\r\n This is a flock!\\\r\n \\\r\n \\\r\n \\\r\n '.replace(/\\s{1,}/ig, ' ').replace(/> <');\r\n\r\n var actual = '' + ((Ti && Ti.XML) || new XMLSerializer()).serializeToString(feed);\r\n\r\n if (Ti) {\r\n Ti.API.info('Expected:\\n' + expected);\r\n Ti.API.info('Actual:\\n' + actual);\r\n }\r\n else {\r\n console.log('Expected:\\n' + expected);\r\n console.log('Actual:\\n' + actual);\r\n }\r\n\r\n if (expected != actual) {\r\n alert('FAIL! Check logs for more information.');\r\n }\r\n else {\r\n alert('PASS!');\r\n }\r\n})(this['document'], this['Ti']);\r\n{code}\r\n\r\nh2. Test Results\r\n\r\nh3. Chrome\r\n**PASS**\r\nThe expected and actual are equal.\r\n\r\nh3. Android Galaxy Tab 7.0+ (3.2)\r\n**FAIL**\r\nThe actual results are as follows (once problem #1 is resolved):\r\n{code:title=actual.xml}\r\n\r\n\r\n http://appc.me/odata/flocker/4f9f037df04d4613dc0607d7\r\n 4f9f037df04d4613dc0607d7\r\n \r\n \r\n \r\n This is a flock!\r\n \r\n \r\n \r\n \r\n\r\n{code}\r\nNote these discrepancies:\r\n1. \"xmlns\" prefix renamed to \"n1\".\r\n2. \"atom\" prefix renamed to \"n0\".\r\n3. Explicit definition of \"xmlns\" as \"xmlns:n1\".\r\n4. With explicit \"n1\" definition, \"d\" and \"m\" namespaces are placed under \"n1:\" instead of \"xmlns:\".\r\n5. Disregarding \"d:\" and \"m:\" in favor of redefining the new namespaces \"n2\" and \"n3\" for \"n2:properties\" and \"n3:message\". Should be \"m:properties\" and \"d:properties\".", "attachment": [], "flagged": false, "summary": "Android: XML: Erratic Namespace Definition and Redefinition", "creator": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": "Titanium SDK version: 2.1.0 (04/27/12 17:36 d33ece4)", "comment": { "comments": [ { "id": "193464", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Not ready to create this ticket.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2012-05-02T12:13:02.000+0000", "updated": "2012-05-02T12:13:02.000+0000" }, { "id": "193974", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Ready to make this ticket now. Will take a bit to update it, hold tight...", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2012-05-07T10:38:21.000+0000", "updated": "2012-05-07T10:38:21.000+0000" }, { "id": "193983", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Updated. Ready for escalation.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2012-05-07T11:42:32.000+0000", "updated": "2012-05-07T11:42:32.000+0000" }, { "id": "195317", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "With the new fix change line 44 to:\r\n{code:javascript}\r\nvar actual = ((Ti && Ti.XML) || new XMLSerializer()).serializeToString(feed);\r\n{code}\r\n\r\nWe now properly output the XML declaration so no need to append this onto the result.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-18T12:42:34.000+0000", "updated": "2012-05-18T12:42:34.000+0000" }, { "id": "195319", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pull request [#2225|https://github.com/appcelerator/titanium_mobile/pull/2225] is up.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-18T12:46:09.000+0000", "updated": "2012-05-18T12:46:09.000+0000" }, { "id": "195865", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 2.0.2.v20120522180515 on Samsung Galaxy 4.0.4", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-23T17:59:42.000+0000", "updated": "2012-05-23T17:59:42.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }