+ Start a Discussion

XMLStreamReader class's continue; statement not working

Hi all,

   I have one problem of 'continue;' statement.

      XmlStreamReader reader = new XmlStreamReader(docContent);

             if (reader.getEventType() == XmlTag.END_ELEMENT) {            

            elseif(reader.getEventType() == XmlTag.CHARACTERS                      



    i want to when ever meet the event type is END_ELEMENT the loop will terminate and go to next iteration. we all knew that 'continue' could proceed as the same. but here the if(Red marking) condition only repeated till the limit exception(20000 times). but i want to only terminate the iteration which met condition. If i put break; means terminate the overall loop. what to do..

Best Answer chosen by Admin (Salesforce Developers) 

Call next() before continue or restructure your code as an if-then-else setup.