{ "id": "61494", "key": "TIMOB-862", "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": "11224", "name": "Release 1.4.0", "archived": true, "released": true, "releaseDate": "2010-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:54:28.000+0000", "created": "2011-04-15T02:38:01.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "android", "defect", "xml" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:54:28.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}

Example XML feed

\n
\n<title>some title</title>\n<description><![CDATA[Some text]]></description>\n
\n

the following code works in iphone but not on android to extract\ndescription:

\n
\nvar title = item.getElementsByTagName(\"title\").item(0).text;\nvar description = item.getElementsByTagName(\"description\").item(0).text;\n
{html}", "attachment": [], "flagged": false, "summary": "on android cdata from xml returns blank", "creator": { "name": "masood", "key": "masood", "displayName": "Masood", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "masood", "key": "masood", "displayName": "Masood", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124213", "author": { "name": "masood", "key": "masood", "displayName": "Masood", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

found answer on q&a, this works on android:

\n
\nvar description = item.getElementsByTagName(\"description\").item(0).firstChild.nodeValue.text;\n
\n

please close this ticket. thanks.

{html}", "updateAuthor": { "name": "masood", "key": "masood", "displayName": "Masood", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:38:02.000+0000", "updated": "2011-04-15T02:38:02.000+0000" }, { "id": "124214", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This bug is legitimate, and also affects other sorts of\nsituations such as embedded child elements:

\n
\n    Ti.XML.parseString('<div>foo <span>bar</span> baz</div>').documentElement.text\n
\n

gives 'foo bar baz' as expected on iPhone;
\ngives 'foo baz' on Android.

\n

The bug is in ElementProxy:

\n
\n    public String getText() {\n            StringBuilder sb = new StringBuilder();\n            NodeList children = element.getChildNodes();\n            for (int i = 0; i < children.getLength(); i++)\n            {\n                    Node child = children.item(i);\n                    if (child.getNodeType() == Node.TEXT_NODE) {\n
\n

// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

\n
\n                            sb.append(((Text)child).getNodeValue());\n                    }\n            }\n\n            return sb.toString();\n    }\n
\n

That explicit check for text child nodes fails to include text\ncontent from character entities, CDATA sections, or child elements\nwhich themselves contain text.

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:38:03.000+0000", "updated": "2011-04-15T02:38:03.000+0000" }, { "id": "124215", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [9b3c7fa6daba96d532b223be26f7746aa97e0231])\nalso handle elements, entities, and CDATA sections in\nElementProxy.getText() [#862 state:resolved] \nhttp://github.com/appcelerator/titanium_mobile/commit/9b3c7fa6daba9...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:38:03.000+0000", "updated": "2011-04-15T02:38:03.000+0000" }, { "id": "124216", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Confirmed that fixes my problem case -- thanks!

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:38:03.000+0000", "updated": "2011-04-15T02:38:03.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }