{ "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
\nthe following code works in iphone but not on android to extract\ndescription:
\nvar title = item.getElementsByTagName(\"title\").item(0).text;\nvar description = item.getElementsByTagName(\"description\").item(0).text;
\n
found answer on q&a, this works on android:
\nvar description = item.getElementsByTagName(\"description\").item(0).firstChild.nodeValue.text;
\n
\nplease close this ticket. thanks.
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
\ngives 'foo bar baz' as expected on iPhone;
\ngives 'foo baz' on Android.
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
\nThat explicit check for text child nodes fails to include text\ncontent from character entities, CDATA sections, or child elements\nwhich themselves contain text.
(from [9b3c7fa6daba96d532b223be26f7746aa97e0231])\nalso handle elements, entities, and CDATA sections in\nElementProxy.getText() [#862 state:resolved] \nhttp://github.com/appcelerator/titanium_mobile/commit/9b3c7fa6daba9...
Confirmed that fixes my problem case -- thanks!