eugene.litvinov Posted May 17, 2011 Posted May 17, 2011 We use xml to describe locale string table, for example, one node can be: <calendar_desc> <font size="24"> Алый мрак в небесной черни </font> <br/> — Алый мрак в небесной черни<br/> Начертил пожаром грань.<br/> Я пришел к твоей вечерне,<br/> Полевая глухомань. </calendar_desc> this node describe Russian text, that will be set to WidgetLabel::setText() that can view rich formatted text. So this node can contain only text, or some rich text tags and/or simple text. How could I parse this node, that set it to WidgetLabel and see correct rich text? I used Xml::getData(), but this works only with simple text, and ignores all included rich tags. Thanks. 1
ulf.schroeter Posted May 17, 2011 Posted May 17, 2011 Use a CDATA section which starts with "<![CDATA[" and ends with "]]>" for your node data. Some more details here
michael.zhang Posted May 17, 2011 Posted May 17, 2011 Try: Xml::getSubTree Xml::getFormattedSubTree Which returns to you the Xml code itself.
eugene.litvinov Posted May 18, 2011 Author Posted May 18, 2011 It looks like Unigine have some own XML-specification, cause it can load and view in WidgetLabel this xml correct: <calendar_desc value=" <font size=24> Алый мрак в небесной черни </font> <br/> <br/> — Алый мрак в небесной черни<br/> Начертил пожаром грань.<br/> Я пришел к твоей вечерне,<br/> Полевая глухомань. "/> But in valid xml this attribute throw an error, cause in xml attributes we can not use < > & " ' symbols. In valid xml this symbols must be replaced theirs equals: & < > " "'. If we do it Unigine correct load this xml, but in this case in WidgetLabel we see this text: <font size=24>Алый мрак в небесной черни</font><br/><br/>— Алый мрак в небесной черни<br/>Начертил пожаром грань.<br/>Я пришел к твоей вечерне,<br/>Полевая глухомань. It seems like WidgetLabel replace & < > " "' to < > & " ' but "not see" their real destination. Maybe this is a bug, and WidgetLabel must correct convert and use this tags (not only convert, like now)? 1
Recommended Posts