{ "id": "91211", "key": "TIMOB-8952", "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": "13405", "description": "Sprint 2012-09 API", "name": "Sprint 2012-09 API", "archived": true, "released": true, "releaseDate": "2012-05-06" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-05-03T16:45:14.000+0000", "created": "2012-05-02T12:08:45.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "qe-port" ], "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" }, "inwardIssue": { "id": "91212", "key": "TIMOB-8953", "fields": { "summary": "Android: XML: Erratic Namespace Definition and Redefinition", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2012-05-14T20:48:13.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h1. Problem\r\nThere are several problems preventing proper XML generation in Titanium:\r\n\r\n1. When an element is appendChild'd to a parent on iOS, it loses its namespace. This is exhibited in all of the elements, other than \"feed\", below. Plus, an extra xmlns:xmlns attribute is added to \"feed\".\r\n2. \"xmlns\" cannot be used in an attribute NS. Browsers don't impose this restriction. Why do we? It is preventing me from defining a namespace. This blocking problem can be worked around by removing lines 26-27 and 42-43 of TiDOMValidator.m.\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 = document.createElementNS('http://www.w3.org/2005/Atom', 'atom:id');\r\n id.appendChild(document.createTextNode('http://appc.me/odata/flocker/4f9f037df04d4613dc0607d7'));\r\n feed.documentElement.appendChild(id);\r\n\r\n var title = document.createElementNS('http://www.w3.org/2005/Atom', 'atom:title');\r\n title.appendChild(document.createTextNode('4f9f037df04d4613dc0607d7'));\r\n feed.documentElement.appendChild(title);\r\n\r\n var entry = document.createElementNS('http://www.w3.org/2005/Atom', 'atom:entry');\r\n var content = document.createElementNS('http://www.w3.org/2005/Atom', 'atom:content');\r\n content.setAttribute('type', 'application/xml');\r\n var properties = document.createElementNS('http://schemas.microsoft.com/ado/2007/08/dataservices/metadata', 'm:properties');\r\n\r\n var message = document.createElementNS('http://schemas.microsoft.com/ado/2007/08/dataservices', 'd:message');\r\n message.appendChild(document.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, Firefox, Safari\r\n**PASS**\r\nThe expected and actual are equal.\r\n\r\nh3. iPhone Simulator 5.1\r\n**FAIL**\r\nThe actual results are as follows (once problem #1 is resolved):\r\n{code:title=actual.xml}\r\nhttp://appc.me/odata/flocker/4f9f037df04d4613dc0607d74f9f037df04d4613dc0607d7This is a flock!\r\n\r\n{quote}\r\nNote these discrepancies:\r\n1. Extra xmlns:xmlns attribute on \"feed\".\r\n2. \"properties\" has lost its prefix.\r\n3. \"message\" has lots its prefix.\r\n4. \"id\", \"title\" have lost their prefix.", "attachment": [], "flagged": false, "summary": "iOS XML: appendChild Removes Namespace and Over Validation", "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": "193557", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "Adjusted. Chrome was being graceful and working properly despite me doing the XML generation... poorly. The above code should now be an accurate reflection of something that works in modern browsers, and should work in Titanium as well.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2012-05-03T08:28:23.000+0000", "updated": "2012-05-03T08:28:23.000+0000" }, { "id": "193646", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Pull pending https://github.com/appcelerator/titanium_mobile/pull/2134", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-05-03T16:09:06.000+0000", "updated": "2012-05-03T16:09:06.000+0000" }, { "id": "194732", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 2.0.2.v20120514121649 with iPhone Simulator 5 and iPhone 4 5.0.1 (When testing on the device: add this code: var win = Ti.UI.createWindow(); or it will fail to build because there is no window in the code)", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-14T15:11:35.000+0000", "updated": "2012-05-14T15:11:35.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }