Srijan Roy

Srijan Roy

  • NA
  • 1
  • 0

String Data Extract to Array.

Aug 7 2010 6:03 AM
I HAVE A STRING AS FOLLOWS: -

<QuestionTable>
<id>1</id>
<q>WHAT IS OUR NATIONAL FRUIT?</q>
<o1>MANGO</o1>
<o2>ORANGE</o2>
<o3>GUAVA</o3>
<o4>GRAPES</o4>
</QuestionTable>
<QuestionTable>
<id>2</id>
<q>WHAT IS OUR NATIONAL LANGUAGE</q>
<o1>BENGALI</o1>
<o2>TELEGU</o2>
<o3>HINDI</o3>
<o4>ENGLISH</o4>
</QuestionTable>
<QuestionTable>
<id>3</id>
<q>WHAT IS OUR NATIONAL FLOWER</q>
<o1>MARIGOLD</o1>
<o2>TULIP</o2>
<o3>LOTUS</o3>
<o4>ROSE</o4>
</QuestionTable>
<QuestionTable>
<id>4</id>
<q>WHAT IS OUR NATIONAL ANTHEM</q>
<o1>JAI HIND</o1>
<o2>JANAGAMANA</o2>
<o3>WE SHALL OVER COME</o3>
<o4>SARE JAHA SE ACCHA</o4>
</QuestionTable>
<QuestionTable>
<id>5</id>
<q>WHAT IS OUR NATIONAL BIRD</q>
<o1>PIGEON</o1>
<o2>PEACOCK</o2>
<o3>SPARROW</o3>
<o4>CUCKOO</o4>
</QuestionTable>

NOW I WANT TO EXTRACT THE DATA FROM IT AND PUT THAT IN SEPARATE ARRAY FOR EACH TYPE i.e.
string[] qArray,o1Array,o2Array,o3Array,o4Array;
qArray[] will Contain all Data inside <q> and </q>
o1Array[] will Contain all Data inside< o1> and </o1>
etc.
I think splitstring method along with regXwill do that but I cant do that.
Can Anyone Help me.

Answers (1)