I have an XML which contains a field of the type:
<mytext><![CDATA[ My name is <color value="FF0000">Bill</color>. ]]></mytext>
Since I’m new to E4X methods, I wonder if there is a simple methodology (using E4X methods) in order to print the inner text: “My name is Bill.” in a text area and having the word “Bill” colored i.e. red.
The generalized situation is, if i can print the inner text and use XML tags to specify formatting attributes of the text per word.
Do E4X supports this type of parsing, or do I have to program my own “little” parser for this situation?
First, let’s normalize the html content (I added a
<content>tag to make it valid):Next step is to parse the given XML:
Then you have to substitute your custom tags with standard tags:
And finally, you can use an
s:RicheEditableTextto display your text