0

I have url www.test.com/test/xml

in xml file have

<channel>
  <item id="001">
  <title>a001</title>
  <actorlist>
     <actor>
       <name> a1 </name>
       <name_drama> d1 </name_drama>
     </actor>
     <actor>
       <name> a2 </name>
       <name_drama> d2 </name_drama>
     </actor>
    <actor>
   <gallery>
     <gimages>
        <gsmall>  sg1.png  </gsmall>
        <gmedium> mg1.png  </gmedium>
        <glarge>  lg1.png  </glarge>
     </gimages>
     <gimages>
        <gsmall>  sg2.png  </gsmall>
        <gmedium> mg2.png  </gmedium>
        <glarge>  lg2.png  </glarge>
      </gimages>
     <gimages>
   <gallery>
</item>
<item id="002">
  <title>b002</title>
  <actorlist>
     <actor>
       <name> a12 </name>
       <name_drama> d12 </name_drama>
     </actor>
     <actor>
       <name> a22 </name>
       <name_drama> d22 </name_drama>
     </actor>
    <actor>
   <gallery>
     <gimages>
        <gsmall>  sg12.png  </gsmall>
        <gmedium> mg12.png  </gmedium>
        <glarge>  lg12.png  </glarge>
     </gimages>
     <gimages>
        <gsmall>  sg22.png  </gsmall>
        <gmedium> mg22.png  </gmedium>
        <glarge>  lg22.png  </glarge>
      </gimages>
     <gimages>
   <gallery>
</item>
<item id="003">
  <title>c003</title>
  <actorlist>
     <actor>
       <name> a13 </name>
       <name_drama> d13 </name_drama>
     </actor>
     <actor>
       <name> a23 </name>
       <name_drama> d23 </name_drama>
     </actor>
    <actor>
   <gallery>
     <gimages>
        <gsmall>  sg13.png  </gsmall>
        <gmedium> mg13.png  </gmedium>
        <glarge>  lg13.png  </glarge>
     </gimages>
     <gimages>
        <gsmall>  sg23.png  </gsmall>
        <gmedium> mg23.png  </gmedium>
        <glarge>  lg23.png  </glarge>
      </gimages>
     <gimages>
   <gallery>
</item>
<channel>

How to Parsing to

item1 = title:001,name:a1, name_drama:d1, name:a2,name_drama:d1 . . .

item2 = title:002,name:a12, name_drama:d12, name:a22,name_drama:d22 . . .

item3 = title:003,name:a13, name_drama:d13, name:a23,name_drama:d23 . . .

Zerntrino
  • 67
  • 1
  • 8
  • This is a little unusual. If you tell us why you want the result like that, we might be able to find alternate solutions. Basically, parsing the XML is some work, and I would not generally go through that much work only to put the result in a comma-sep string. – Tony Ennis May 05 '12 at 14:50
  • take a look here http://stackoverflow.com/questions/3839372/android-parsing-xml – Win Myo Htet May 05 '12 at 14:50

2 Answers2

0

Android projects can use any Java library that can be used to parse XML.

Lots of examples of parsing libraries

Community
  • 1
  • 1
OlivierLi
  • 2,798
  • 1
  • 23
  • 30
0

There are different ways to parse you can use java Dom if memory is not the issue else go for java SAX parser. here is the example.

Community
  • 1
  • 1
Shehzad
  • 2,870
  • 17
  • 21