Event processing

Almost all XML processors support event-based parsing. This is arguably the simplest method for information to be passed from the processor to the application. The application responds to 'events' in the data stream. It reacts to information contained in XML markup as it is encountered in the data stream by the XML processor.

A general-purpose programming language, such as 'C' or Java, may be used. The application would include functions to deal with specific kinds of markup, such as 'ProcessOpenTag' to intercept all the start-tags. If contextual processing is required, the current location in the document structure may be tracked using variables to indicate which elements are currently open.

In the following example, the first ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.