{ "id": "62084", "key": "TIMOB-1452", "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": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:56:12.000+0000", "created": "2011-04-15T02:53:12.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "apidoc", "ios", "iphone", "output", "patch", "serialize", "xml" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:56:12.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}
Titanium Mobile provides a DOM interface for working with XML\ntrees, and a point to parse a string into XML:\nTitanium.XML.parseString. However there appears to be no way to\nserialize a DOM tree back to XML for output, such as saving to a\nfile, sending over the network, saving in a database, or feeding\nthrough an event into a WebView.
\nOur StatusNet client application reads data from Atom feeds and\ncaches the individual entries into a local database, which we\ncurrently can't do with no way to get flat XML back out of the DOM\ntrees.
\nIn Titanium Desktop, we use the XMLSerializer interface like\nthis:
\nvar xml = (new XMLSerializer()).serializeToString(node);
\nIf the equivalent interface can't be simply exposed into the\ngeneral namespace, it might be good to expose a minimal interface\non Titanium.XML, perhaps like this:
\nvar xml = Titanium.XML.serializeToString(node);
Patch on my github branch:
\n\nhttp://github.com/brion/titanium_mobile/commit/46ebc43e9e670259c39d...
(Android and iPhone) Adds Titanium.XML.serializeToString()\nmethod to create an XML string from a DOM node or document.
\nSample implementation for
\n\nhttps://appcelerator.lighthouseapp.com/projects/32238/tickets/1452-...
\nerialize-dom-trees-back-to-xml-on-mobile-save-xml-output
Appcelerator contributor license agreement has been signed -\nbrion@status.net /
\nbrion@pobox.com
i will merge.
\nthanks very much!
I've updated my work branch so the Android implementation is\ncompatible with 1.6 (the first version only worked on 2.2):\n\nhttp://github.com/brion/titanium_mobile/commits/xml-serialize
\nLatest commit: \nhttp://github.com/brion/titanium_mobile/commit/37bec7a0055f99f6fdfa...
Per Don's recommendation I've also added a demo/test case to the\nKitchenSink XML demos in my branch:
\n\nhttp://github.com/brion/titanium_mobile/commit/1c6a5c916ccee3d80fc3...
Note this branch currently also includes my fix for the other\nXML test cases on iOS -- ticket 1624:
\n\nhttps://appcelerator.lighthouseapp.com/projects/32238-titanium-mobi...
Cleaned up and separated the three pieces into three commits to\nmake it easier to review:
\n\nhttp://github.com/brion/titanium_mobile/commits/xml-serialize-updated
Android implementation:
\n\nhttp://github.com/brion/titanium_mobile/commit/324e61363e0890bd9a8c...
iOS implementation:
\n\nhttp://github.com/brion/titanium_mobile/commit/ecdf14ba53587981583f...
KitchenSink demo/test case:
\n\nhttp://github.com/brion/titanium_mobile/commit/6d1c218841b8e606a48a...
The fix for the other XML test cases on iOS is separately linked\non ticket 1624, so be aware that if that's not merged, the\nKitchenSink demo will throw a scary red error screen when run on\niPhone.
Is any further action required on this? Looks like it's been\nmerged on iPhone, Android, & the KitchenSink tests.
Here's another patch adding the new method to API docs:
\n\nhttp://github.com/brion/titanium_mobile/commit/036bfaae37bc7d2d2334...
\nHowever I notice there's no way to override the 'since' version\nof 0.8 that's on the Ti.XML module: \nhttps://appcelerator.lighthouseapp.com/projects/32238-titanium-mobi...
Merged documentation. Sending to QA.
iOS 4.1 and 3.1.2; android 2.2 and 1.6