Abhinav
Abhinav

Reputation: 752

How to parse data from xml files written for flash in android?

I made some flash files(.xml) for my online website. Now i want that data in those xml files for my android app. how can i achieve that. The xml files are pretty much in good format, neat and properly written. Here is a little code of that xml file which is pretty much same in all others also.thnx in advance.

<slide id="2" template="listeningStayMultiText">
    <images>
        <image direction="Right" xCord="100" yCord="170"><![CDATA[images/common/1x1.gif]]></image>
    </images>
    <sentences>
        <sentence index="1"  fontColor="0x000000"  width="600" height="70" size="18" xPos="50" yPos="20" bgColor="0xDBEFDF" borderColor="0x006600" align="left"><![CDATA[<br/>  Let’s look at how we make negative sentences in the simple present tense -]]></sentence>
        <sentence index="2"  fontColor="0xffffff"  width="300" height="60" size="18" xPos="50" yPos="100" bgColor="0x006600" borderColor="0x000000" align="center"><![CDATA[<br/>POSITIVE SENTENCE]]></sentence>
        <sentence index="3"  fontColor="0xffffff"  width="300" height="60" size="18" xPos="350" yPos="100" bgColor="0x006600" borderColor="0x000000" align="center"><![CDATA[<br/>NEGATIVE SENTENCE]]></sentence>
        <sentence index="4"  fontColor="0x000000"  width="300" height="120" size="18" xPos="50" yPos="160" bgColor="0xDBEFDF" borderColor="0x000000" align="center"><![CDATA[<br/>I play football]]></sentence>
        <sentence index="5"  fontColor="0x000000"  width="300" height="120" size="18" xPos="350" yPos="160" bgColor="0xDBEFDF" borderColor="0x000000" align="center"><![CDATA[<br/>I <b>do not</b> play football<br/>OR<br/>I <b>don't</b> play football]]></sentence>
        <sentence index="6"  fontColor="0x000000"  width="600" height="90" size="18" xPos="50" yPos="300" bgColor="0xDBEFDF" borderColor="0x000000" align="center"><![CDATA[<br/>We use '<b>do not</b>' or '<b>don’t</b>' with ‘<b>I</b>’ to make negative sentences in the simple present tense.]]></sentence>
    </sentences>
    <audio><![CDATA[images/common/silence.mp3]]></audio>        
    <bgImage><![CDATA[images/bg.jpg]]></bgImage>
</slide>

Upvotes: 0

Views: 185

Answers (1)

Fedor Kazakov
Fedor Kazakov

Reputation: 601

Take a look at the Simple framework

It uses annotations with your data model and it very easy to implement. In your case it will look like

@Root
public class Slide {
    @Attribute
    public int id;
    @Attribute
    public String template;
    @ElementList
    public List<Images> image;
    @ElementList
    public List<Sentence> sentences;

}

etc...

Upvotes: 0

Related Questions