-8

I have below string which I get from an xml file.

<product>
<aa>1367</aa>
<ac>133787</ac>
<db>13345</db>
<ce>133</ce>
<er>135</er>
<et>130</et>
<ef>14</ef>
</product>

How do I convert it to an two dimension array like

product[][]={{"aa", "1367"},{"ac","133787"}, {"db","13345"}....}

I only want to use string function and loop.

1 Answers1

4

I think the best way is to use an available XML parser. In this thread: Best XML parser for Java you'll probably find which one is the best to use

Community
  • 1
  • 1
PieterDB
  • 285
  • 4
  • 14