views:

42

answers:

1

Suppose I have the following XML:

var foo:XML = <root><a>this is a <b>special</b> case</a></root>

Is there any way to detect the position of <b> relative to the contents of <a> without a custom subparser?

A: 

You should wrap your data inside CDATA tags, So it isn't based as XML.

Then you can set a textfields htmlText property to get the formatting.

TandemAdam
I didn't ask about TextField or it's properties. This question is about E4X and the XML class.
Ben
Your question is tagged "actionscript-3" so I just assumed. You should think more about your tags!
TandemAdam
No no, the tag is correct. It is an actionscipt 3 project I'm working on. It's just that I'm not using TextField for it. I was planning to use XML to serialize data users entered into a custom UI control.It's essentially a very primitive HTML control like the built-in TextField class, but it uses runtime loaded SVG fonts so it couldn't be based on TextField.What I have ended up doing is serializing the data I'm grabbing from the object through it's inner display tree. When it comes to deserializing I would have preferred to handle an input format like the code block in my original post...
Ben
...ie I'd rather nest tags like in an HTML document rather than creating siblings.Anchor tags for example would be `p ... a ... /a .../p` rather than `p ... /p a ... /a p ... /p`.Sorry I didn't explain properly the first time :-)
Ben