[TIMOB-862] on android cdata from xml returns blank
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:54:28.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.4.0 |
Components | Android |
Labels | android, defect, xml |
Reporter | Masood |
Assignee | Don Thorp |
Created | 2011-04-15T02:38:01.000+0000 |
Updated | 2011-04-17T01:54:28.000+0000 |
Description
Example XML feed
<title>some title</title>
<description><![CDATA[Some text]]></description>
the following code works in iphone but not on android to extract
description:
var title = item.getElementsByTagName("title").item(0).text;
var description = item.getElementsByTagName("description").item(0).text;
found answer on q&a, this works on android:
please close this ticket. thanks.
This bug is legitimate, and also affects other sorts of situations such as embedded child elements:
gives 'foo bar baz' as expected on iPhone;
gives 'foo baz' on Android.
The bug is in ElementProxy:
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That explicit check for text child nodes fails to include text content from character entities, CDATA sections, or child elements which themselves contain text.
(from [9b3c7fa6daba96d532b223be26f7746aa97e0231]) also handle elements, entities, and CDATA sections in ElementProxy.getText() [#862 state:resolved] http://github.com/appcelerator/titanium_mobile/commit/9b3c7fa6daba96d532b223be26f7746aa97e0231"> http://github.com/appcelerator/titanium_mobile/commit/9b3c7fa6daba9...
Confirmed that fixes my problem case -- thanks!