MAINFRAME > Tips & Techniques > Application Development

COBOL and XML Parsers

A guide to processing XML documents stored in files and DB2

A guide to processing XML documents stored in files and DB2

The challenge of programming in any new language is learning the syntax. Depending on the platform and compiler you’re using, you may have to adjust the syntax to take advantage of features built into your compiler. This is the case when working with XML as well. Some XML parsers will only ensure the XML document is well formed, while others check and validate the structure based on a document-type definition (DTD) file.

Just as you have different compilers for a given language, so do you have different parsers for XML. A parser is like a language compiler; you wouldn’t usually build your own compiler, so you’re not going to build a parser. There are hundreds of different flavors of XML parser programs in the marketplace. You’ll usually use the one that comes in your environment.

XML Parsers

Before we dig into the processing-program—or parsing—features found with XML Systems Services on z/OS*, it’s helpful to know more about the common parsing methods. Two general techniques are used for processing XML documents. The first method is simple API for XML (SAX), which is popular over the document object model (DOM).

A parser implemented with SAX processes the document as a data stream, with an event-driven API. The user defines a number of callback routines that will be called when the following events occur:

  • XML text nodes
  • XML element nodes
  • XML processing instructions
  • XML comments

The DOM, on the other hand, has its roots in the browser-processing world. All of the current Web browsers support the DOM method.

Jeff M. Sullivan is a mainframe systems programmer with the State of Arizona. Prior to this position, he was in IBM Systems and Technology Lab Services and Training.


comments powered by Disqus

Advertisement

Advertisement

2018 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

A Beginner's Guide to the REXX Programming Language on z/OS

Reading and Writing Files in the REXX programming language on z/OS.

MAINFRAME > TIPS & TECHNIQUES > APPLICATION DEVELOPMENT

Application Management is Important to the Entire Process

MAINFRAME > TIPS & TECHNIQUES > APPLICATION DEVELOPMENT

Application Testing: Giving Users What They Need

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
Mainframe News Sign Up Today! Past News Letters