ONX Event Parser

The ONX Event Parser is a simple parser based on the "event generator" model. This means that the parser generated events that can be processed by the calling program with a custom event handler. The parser is designed to be very simple to use.

Overview

In order to process the events, the parser has a base event handler that can be customized to add whatever processing is necessary. Each event has a similar format. Each event also returns a logical value. A value of true indicates that the parser should continue parsing. A value of false indicates that the parser should stop where it is. There are five (5) events that the parser generates:

Also, the parser allows the events to be delayed until the entire infoblock has been parsed. The property that controls this is:

Source Code

The parser and samples were written in C++. They should be portable, but I don't guarantee it (I use Borland's compiler under Win2K). If any changes are needed or bugs are encountered, please feel free to let me know.

onxep.cpp / onxep.h : These two files make up the parser itself. Again, it is a very simple implimentation that I put together in an evening. If you see something that is wrong or in bad form, let me know.

onxtest.cpp : this is a simple command-line program that just reads a file and reports whether it is contains valid ONX infoblocks or not.

onxlite.cpp : this is a simple command-line program that reads a file and outputs any valid ONX infoblocks found in the most compact format possible. The only exception is that the values in ValueNodes are not analyzed to ensure the most compact values possible when escape sequences are required. If you want, add it in. It shouldn't be hard, though maybe a bit tedious...