Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3551] CDATA not parsed in strings.xml

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsTooling
LabelsRTN, cb-tooling, cdata, html, strings, xml
Reporternetspy
AssigneeIngo Muschenetz
Created2011-04-15T03:46:33.000+0000
Updated2020-01-09T19:49:39.000+0000

Description

A CDATA section in strings.xml is not parsed by Titanium. This could be necessary if HTML entities are needed.

<?xml version="1.0" encoding="UTF-8"?>
<resources>
  <string name="test"><![CDATA[<h1>Headline</h1>]]></string>
</resources>

L('test') returns only an empty string.

Comments

  1. Chris Barber 2016-08-19

    Confirmed, this is still an issue in Titanium master (currently 6.1.0). The i18n.js file in titanium-sdk/lib only grabs the first child:
       elem.firstChild.data
       
    Since CDATA would introduce more than one child node, we only get the first child node. We will need to serialize the entire node and it's children to a string to be returned.

JSON Source