XML Error ignore and skip

Hello ,

so I have a project that reads a bunch of .xml files and parses the data from them, it seems that on some of them there are errors and I want when I catch something like this to skip over and ignore the error and jump to the next file.

Try
  Xml.LoadXml(f)
Catch err As KeyNotFoundException
  P5FVal = P5FVal + 1
End Try

Code is something like above, the problem is that in the project when I run in Xojo I get error and stopping the code on [quote]Xml.LoadXml(f)[/quote] then it stops and then I have to press resume so that I can run the rest.

By doing that it seems that the code runs again and all is processed if no other errors.

IS there a way to ignore that and skip the file ? even thinking to move the file in another folder like corruptedFiles or something like that .

Thanks.

may be it’s because you have “break on exception” checked under the project menu ?

Good point , I will have to check on that .

Thanks.

Jean-Yves is likely correct, and you can disable it on a method by method basis with #pragma BreakOnExceptions false.
http://documentation.xojo.com/api/language/pragma_directives.html

(this lets you keep that very useful feature on, but disable it for methods in which you do expect and handle them)