IBM Systems Magazine, Mainframe Edition - May/June 2010 - (Page 50)

Developer System z application development COBOL and XML Parsers A guide to processing XML documents stored in files and DB2 BY T RO Y COL EM AN T he 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 Editor’s Note: This is the second in a continuing series on XML, DB2* and COBOL* development on the z/OS* platform. For an introduction to XML and some of the syntax associated with the language, read “Process XML Documents Within COBOL and DB2” ( mainframe/septemberoctober09/ administrator/26607p1.aspx). 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. the document object model (DOM). A parser implemented with SA X processes the document as a data stream, with an event-dr iven API. The user defines a number of callback routines that will be called when the following events occur: h h h h XML text nodes XML element nodes XML processing instructions XML comments The DOM, on the other hand, has its Before we dig into the processingprogram—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 roots in the browser-processing world. All of the current Web browsers support the DOM method. Enterprise COBOL for z/OS version 4.1 uses the SAX method. The amount of memory required to parse a document 50 MAY/JUNE 2010

Table of Contents for the Digital Edition of IBM Systems Magazine, Mainframe Edition - May/June 2010

IBM Systems Magazine, Mainframe Edition - May/June 2010
Editor's Desk: Planned to a 'T"
Dashboard: Beef Up Your Passwords
Data Display: Cost of Security Breaches
IT Today: IBM Partnership Offers Cost-Effective BI Solutions
Trends: IBM's Eagle Studies Provide a Clear View of True Technology Costs Both Internal and External Communications
Insider: Six Computing Strategies for a Recovering Economy
Case Study: The Office of the CIO with the State of Nebraska Improved Data-Handling Issues with Smarter and Faster Data-Storage Tools
Harnes the Information Expansion: Discover the Hidden Value in your Business Data with System z
Green with Envy: Syracuse University's New Data Center is One to Covet
Focus on Storage: Tivoli Storage-Management Solutions Reduce Costs and Improve Efficiency
Developer: A Guide to Processing XML Documents Stored in Files and DB2
Advertisers' Index
Stop Run: IBM's Plant-A-Tree Initiative Grows in Italy
Reference Point

IBM Systems Magazine, Mainframe Edition - May/June 2010