If you use the RTE you can either load the XML into its text property, in which case the XML will appear with all tags, or into its htmlText property, in which case the tags will be stripped out.
But then you have the problem of the text in each node appearing on a separate line. The solution to that is to set the condenseWhite property, not of the RTE itself, but of the textArea property of the RTE: myRTE.textArea.condenseWhite = true; I think you need to do this when the RTE is initialized. Now to the whitespace. The problem with your code is that the whitespace property is static -- you don't set it on your XML instance; you set it on the XML class. So you should put this after your import statements: XML.ignoreWhitespace = false; -- David --- In [email protected], "stldvd" <stl...@...> wrote: > > Hi all, > > I'm working with httpservice and a rich text area. I pull in the xml via > httpservice, then parse out all xml tags. However, dependent on the XML I > need to do various things, such as if the text is in an <boldMe> tag, then > make it bold; if it's in an <italicizeMe> tag, then I'll italicize it, then > display it, correctly formatted, in the RTE. > > Questions: > 1) I need to have the <P> tags create new lines. Not sure how to do that > without kludgy regular expressions. That can't be the best way. Can it? :) > 2) I want to keep the whitespace, but as you'll see that isn't happening. > > Thanks, > > David > > ******************************************* > Code: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application > xmlns:mx="http://www.adobe.com/2006/mxml" > width="900" height="800" > initialize="initializeHandler();" > > > > <mx:Script> > <![CDATA[ > import mx.rpc.events.ResultEvent; > import flash.text.TextFormat; > > [Bindable] public var xData:XML; > > private function initializeHandler():void > > { > bt.send(); > } > > private function btRPCResult(event:ResultEvent):void > { > xData = event.result as XML; > xData.ignoreWhitespace = false; > } > > private function showTest():void { > outField.text = ""; > for each (var item:XML in xData.Content.P.*) { > //here's where I want to conditionally act upon > the text of boldMe, italicizeMe, etc. > outField.text += item; > } > } > > ]]> > </mx:Script> > > <mx:HTTPService id="bt" url="test.xml" result="btRPCResult(event)" > resultFormat="e4x"/> > > <!-- User interface --> > <mx:ApplicationControlBar dock="true"> > > <mx:Button label="Show Test Story" click="showTest()" /> > </mx:ApplicationControlBar> > <mx:TextArea id="outField" width="100%" height="100%" > text="{xData.toString()}" /> > </mx:Application> > > test.xml: > > <Text> > <Content> > <P> > The quick <boldMe>brown</boldmMe> > <italicizeMe>fox</italicizeMe> jumps over the > <boldMe>lazy</boldMe> dog. > </P> > <P> > Now is the time for all <boldMe>good</boldMe> men to > come to the aid of their <italicizeMe>country</italicizeMe>. > </P> > </Content> > </Text> >

