Helpful Information
 
 
Category: Programming Languages More
Reading XML doc using JDOM problem

Hello,

I have an xml doc eg:
- <report>
- <sub_report>
<date required="Yes">Friday, January 11, 2002(0830)</date>
<heading>Report BLAH</heading>
- <sub_heading>
<sub_heading_name>Customer</sub_heading_name>
</sub_heading>
- <sub_heading>
<sub_heading_name>Number</sub_heading_name>
</sub_heading>
- <sub_heading>
<sub_heading_name>Counterparty</sub_heading_name>
</sub_heading>
- <data_row>
<data>BLAH</data>
<data>100</data>
<data>AAA Ltd.</data>
</data_row>
- <data_row>
...
</data_row>
</sub_report>
<sub_report>
...
</sub_report>
...
</report>

So each report has a sub_report. The problem I am getting is that when I use Jdom to extract the data from the xml doc, it looks at the first sub_report it meets and proceeds to parse though it. Once finished it comes out, sees "sub_report" again and parses the same sub_report it just came from again, and not going on to the next one!

I realise I could make matters easier by labeling the sub_report like such, sub_report1, sub_report2, sub_report3... but for other reasons (XSLT hic-cups) I would rather keep it the way it is.

If anyone has used Jdom extensively and perhaps has an answer to making it skip over roots it has done before with the same name then please let me know.

Thanks in advance!










privacy (GDPR)