{ "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.

\n

Our 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.

\n

In Titanium Desktop, we use the XMLSerializer interface like\nthis:

\n

var xml = (new XMLSerializer()).serializeToString(node);

\n

If 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:

\n

var xml = Titanium.XML.serializeToString(node);

{html}", "attachment": [], "flagged": false, "summary": "Need way to serialize DOM trees back to XML on mobile (save XML output)", "creator": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "125740", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Patch on my github branch:
\n\nhttp://github.com/brion/titanium_mobile/commit/46ebc43e9e670259c39d...

\n

(Android and iPhone) Adds Titanium.XML.serializeToString()\nmethod to create an XML string from a DOM node or document.

\n

Sample implementation for
\n\nhttps://appcelerator.lighthouseapp.com/projects/32238/tickets/1452-...
\nerialize-dom-trees-back-to-xml-on-mobile-save-xml-output

\n

Appcelerator contributor license agreement has been signed -\nbrion@status.net /
\nbrion@pobox.com

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:13.000+0000", "updated": "2011-04-15T02:53:13.000+0000" }, { "id": "125741", "author": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "body": "{html}

i will merge.
\nthanks very much!

{html}", "updateAuthor": { "name": "jhaynie", "key": "jhaynie", "displayName": "Jeff Haynie", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:13.000+0000", "updated": "2011-04-15T02:53:13.000+0000" }, { "id": "125742", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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

\n

Latest commit: \nhttp://github.com/brion/titanium_mobile/commit/37bec7a0055f99f6fdfa...

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:13.000+0000", "updated": "2011-04-15T02:53:13.000+0000" }, { "id": "125743", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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...

\n

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...

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:14.000+0000", "updated": "2011-04-15T02:53:14.000+0000" }, { "id": "125744", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

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

\n

Android implementation:
\n\nhttp://github.com/brion/titanium_mobile/commit/324e61363e0890bd9a8c...

\n

iOS implementation:
\n\nhttp://github.com/brion/titanium_mobile/commit/ecdf14ba53587981583f...

\n

KitchenSink demo/test case:
\n\nhttp://github.com/brion/titanium_mobile/commit/6d1c218841b8e606a48a...

\n

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.

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:14.000+0000", "updated": "2011-04-15T02:53:14.000+0000" }, { "id": "125745", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Is any further action required on this? Looks like it's been\nmerged on iPhone, Android, & the KitchenSink tests.

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:14.000+0000", "updated": "2011-04-15T02:53:14.000+0000" }, { "id": "125746", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Here's another patch adding the new method to API docs:

\n

\nhttp://github.com/brion/titanium_mobile/commit/036bfaae37bc7d2d2334...

\n

However 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...

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:14.000+0000", "updated": "2011-04-15T02:53:14.000+0000" }, { "id": "125747", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Merged documentation. Sending to QA.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:15.000+0000", "updated": "2011-04-15T02:53:15.000+0000" }, { "id": "125748", "author": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

iOS 4.1 and 3.1.2; android 2.2 and 1.6

{html}", "updateAuthor": { "name": "thomashuelbert", "key": "thomashuelbert", "displayName": "Thomas Huelbert", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:53:15.000+0000", "updated": "2011-04-15T02:53:15.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }