Calling XML gurus: NotesSAXParser question

Is there a way of stopping a saxParser.Process immediately if a condition is met in one of the On Event calls?

Something like a ‘Sax.Parser.StopNow = True’ would be nice.

Thanks in advance.

Subject: Calling XML gurus: NotesSAXParser question.

Hmm… this sounds like more of a general LotusScript question. You could possibly raise an error yourself (see the “Error” call in the designer help), trap it, set some global variable if need be and then “Resume” back to some other piece of code. From there you could handle things however you want.

Subject: RE: Calling XML gurus: NotesSAXParser question.

Erik

Thanks for the reply.

That is pretty much what I’ve done. I set a global flag (true) when a specific condition is met and every SAX On Event call only executes if the flag is set false. However, there is no way to actually stop the parser for processing the input stream. So if you have a very long input stream (5Mb) and the error condition occurs early on, the saxParser.Process must run through the whole of the input stream before it returns control to the LS code.

Subject: RE: Calling XML gurus: NotesSAXParser question.

Have you looked at the C API? I’m not sure if the parsing functions are exposed. If they are, you may be able to trap an error at some lower level.

Subject: RE: Calling XML gurus: NotesSAXParser question.

Hi,

maybe you can try to set the position property of the input stream to the end of the stream. Haven’t yet tried but could work.

Alois

Subject: RE: Calling XML gurus: NotesSAXParser question.

Alois,

I’ve just tried to set:

notesStream.Position = -1

From the Debugger I can see that the notesStream.position gets set to the same value as notesStream.Bytes. So the position is the end of the instream. Unfortunately, is makes no difference. The Parser still runs though the whole input stream before it passes control back.

Thanks anyway.