Parsers as Objects

Essentially, there are two ways a parser will be used in an application:

  • To see whether an XML document is well-formed

  • As part of a processor

If the second one is the case (and it will be most of the time), the parser can be treated as an object. With Java-based parsers, this means that the parser will be incorporated as a class in the Java application. With C-based parsers, either the source code can be incorporated natively and the arrays and other variables accessed directly, or the parser can be treated as a class with its own methods and properties.

Another method that can be used with Windows applications is to compile the parser as a DLL and use it as a common object model. In fact, all the C parsers in Chapter 14, "Parsing ...

Get XML Unleashed 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.