One common question is: What is the difference between using XML Thunder and an XML parser? XML Thunder and XML parsers can both provide the ability to parse an input XML document, but they differ a lot in functions and features, especially when it comes to COBOL application development.
Here are some highlights of the key differences:
- Parsers require developers to have some XML knowledge
- Parsers usually support API such as DOM and SAX
- Common programming languages for interfacing to parsers are object oriented languages like Java or C++ or C#
- Parsers are used for handling input XML documents only
Sample DOM API Calls
XML parsers still require custom programming logic to navigate a given XML document and extract data values for processing. A parser simply makes an XML document available in memory, and its API — such as Document Object Model (DOM) or Simple API for XML (SAX) — can be used by custom application programming logic to obtain the XML data values. The picture above is a sample of DOM API calls. The parser simply raises programming events that need to be handled by programming logic. The larger and more complex the XML document is, the more complex the application logic will be. Logic branching for XML Choice, Namespaces, and optional vs. required XML nodes are just some of the challenges a developer will face. Complex decision trees and nested repeating structures (i.e. XML branches) also have to be accommodated.
- XML Thunder is a visual GUI designer that developers can use to generate XML Handler code without requiring XML knowledge
- The ability to generate COBOL or C code for both reading and creating XML documents (XML Parsers are used only for reading XML documents)
- XML parsing logic with advanced validation capabilities beyond what most parsers are capable of, such as required field checking and data enumeration validation
Calling an XML Thunder Reader
Unlike XML parsers, XML Thunder generates the subroutine code needed to handle the XML processing for you. It also generates the needed data structures to be loaded or read from. There is no API interfacing, except to CALL the subroutine, from either COBOL or C programs. It hides all the complex XML processing from the calling program. The picture above is an example of how to invoke XML Thunder-generated code to parse an input XML document.
So which should you use?
If you are writing Java or C++ code and are comfortable with XML, then XML parser would be an option to explore, since it is quite accessible in those environments. On the other hand, if you require XML handling in your COBOL, C or TAL programs on the NonStop, then XML Thunder will make your job a lot easier.
Check out our “XML Thunder Guided Tour” to learn more about XML Thunder!
Feedback pleaseDo you find this tutorial blog helpful? Let us know what you think, and how we can make it even better. Don’t forget, you can subscribe to our blogs (top right-hand corner of this page) to get automatic email notification when a new blog is available.
Phil Ly is the president and founder of TIC Software, a New York-based company specializing in software and services that integrate NonStop with the latest technologies, including Web Services, .NET and Java. Prior to founding TIC in 1983, Phil worked for Tandem Computer in technical support and software development.