Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Alternative way of breaking a loop, when condition met

 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic