loop through a list of record [stored in xml] using JAR library and execute specific

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • isaacsanya01
    New Member
    • Nov 2012
    • 6

    loop through a list of record [stored in xml] using JAR library and execute specific

    Hello there,

    I have an xml file that has the following structure

    Aggregation Actions
    Aggregation
    Actions

    Aggregation Actions
    Aggregation
    Actions

    ............... ....
    ............... .
    ............

    I am using java library classes (jar files) to iterate through the xml file as listed below

    The code works fine. The only issue is that it only iterates over the actions of one aggregation (i.e. the first record in the xml)
    Aggregation Actions
    Aggregation
    Actions

    it ignores the 2nd, 3rd, 4th......record s

    Code:
    for (Iterator aggActionsiterator = actionList.iterator(); aggActionsiterator.hasNext();)
    {
    AggregationActions aggregationActions = (AggregationActions) aggActionsiterator.next();
    		
    	ArrayList<Action> actions = (ArrayList<Action>) aggregationActions.getActions(); // this is for aggregation actions
    					 
    // This iterates over the actions of ONE aggregation
    			
    for (Iterator aggActionsIterator = actions.iterator(); aggActionsIterator.hasNext();)
    			{
    Action action = (Action) aggActionsIterator.next();
    				
    if (action.getActionType() == ActionType.SUPPLY)
    {
    // do something for all the aggregation actions in the xml file that is of type supply. however it only does it for 1
    }
    I need a way to iterate over the actions of all the aggregations, and do specific calculations on each aggregation depending on its actions.. Hope this question is clear. Thanks.
    Last edited by Rabbit; Nov 19 '12, 05:27 PM. Reason: Please use code tags when posting code.
Working...