As a general tip, reinventing the wheel is usually a bad idea. There are probably a dozen PHP XML parsers out there, so I can't fathom why you'd write your own.
Anyway, the answer to your question depends largely on how you're implementing the parser. But if it's running in any sort of loop, and I can't imagine how else you'd do it, you can use the break
command to exit the current loop and continue on with the rest of the script.