How to read nested elements in xml with dom parser or whatever



I want to read nested elements and assign all elements and dates to two dimensional array. In the following xml example, the elements are <M-1>,<M-11>,<M-111>,<M-2>,<M-22>,<M-3> and the dates are m111,m22,m3. I want to 2D array like that is String array[][] = {{"M-1","M-11","M-111","m111"},{"M-2","M-22","m22"},{"M-3","m3"}}; Thanks.



<MENU>

<M-1>
<M-11>
<M-111>m111</M-111>
</M-11>
</M-1>

<M-2>
<M-22>m22</M-22>
</M-2>

<M-3>m3</M-3>

...

</MENU>

No comments:

Post a Comment