GeeCON Prague 2014*
The moose likes XML and Related Technologies and the fly likes Alternative way of breaking a loop, when condition met Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Alternative way of breaking a loop, when condition met " Watch "Alternative way of breaking a loop, when condition met " New topic
Author

Alternative way of breaking a loop, when condition met

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 519
    
    2

Hello All,

I have googled and found that there is no way to break from a loop, when a condition is met. But I need some other workaround for my problem.

My problem statement is as follows,

I have a source XML like below


Now, I need to generate a report in a tabular structure, where it should display something like



The above structure is to be displayed in a <td> element, only if for each <errorassociation>, there are atleast one <errorid>. But should not display anything if no <errorid> element is found or the worst if it has <errorid/>.

How can I attain this?


Regards
KumarRaja

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10146
    
165

Kumar Raja wrote:Hello All,

I have googled and found that there is no way to break from a loop, when a condition is met.


What kind of loop?

Kumar Raja wrote:
My problem statement is as follows,

I have a source XML like below
...

Now, I need to generate a report in a tabular structure, where it should display something like

...

The above structure is to be displayed in a <td> element, only if for each <errorassociation>, there are atleast one <errorid>. But should not display anything if no <errorid> element is found or the worst if it has <errorid/>.

How can I attain this?


What does your current code look like? Post the relevant part of that code.

[My Blog] [JavaRanch Journal]
 
GeeCON Prague 2014
 
subject: Alternative way of breaking a loop, when condition met