Jump to content

Convert Xml node's children to string


photo

Recommended Posts

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.

  • Like 1
Link to comment

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)?

  • Like 1
Link to comment
×
×
  • Create New...