Reading xml within xml as String in flex/AS3

Posted by duder on Stack Overflow See other posts from Stack Overflow or by duder
Published on 2010-06-16T01:59:34Z Indexed on 2010/06/16 2:02 UTC
Read the original article Hit count: 448

Filed under:
|
|

I'm getting XML input that looks like this

<?xml version="1.0" encoding="utf-8"?>
<data1>this is data 1</data1>
<data2>this is data 2</data2>
<data3>
      <3a>this is data 3a</3a>
      <3b>this is data 3b</3b>
      <3c>
            <TextFlow xmlns="http://ns.adobe.com/textLayout/2008">
                    <p direction="ltr" >
                           <span>some text</span>
                           <span>some additional text</span>
                    </p>
                    <p direction="ltr">
                           <span>some text</span>
                           <span>some additional text</span>
                    </p>
             </TextFlow>
       </3c>
</data3>

I can read <data1> with event.result.data1 which outputs a string this is data1

But when I do the same thing to event.result.data3.3c, it prints object [object] so I guess it's trying to dig deeper into the tree. But I need the actual string text (not xml tree) starting from and including <TextFlow></TextFlow> to be stored and printed as a string. Any idea what's the syntax for this?

The string I'm looking for would look like this:

        <TextFlow xmlns="http://ns.adobe.com/textLayout/2008">
                <p direction="ltr" >
                       <span>some text</span>
                       <span>some additional text</span>
                </p>
                <p direction="ltr">
                       <span>some text</span>
                       <span>some additional text</span>
                </p>
         </TextFlow>

© Stack Overflow or respective owner

Related posts about Xml

Related posts about flex