How to Parse XML Documents in COBOL

XML messages embedded data in a single string of elements and attributes. This can be a challenge for programs written in languages such as COBOL that store information in specific fields. To work with XML documents, sophisticated parsing and string manipulation routines is required.

Consider the following trivial example for an XML message:


The string processing logic to parse the above XML elements and attributes into COBOL fields is already advanced, but it will quickly grow in complexity for larger messages as you account for context, optional data and repeating structures.

So what are your options?
  1. You can hand write the code to validate, parse, and create XML messages.
  2. You can preprocess the XML with a generic parser.
  3. XML Thunder, the industry-leading solution for modernizing COBOL legacy applications.

XML Thunder is designed specifically to address the challenges of working with XML in legacy applications.   Using a model-driven development approach and XML Thunder’s visual designer, the power is in the coder’s hands to create a mapping of program fields to XML nodes. This mapping – called a Handler Design – is then used to generate all of the COBOL source code needed to parse or create XML. The code is generated as a callable program module that can be used in new or existing COBOL applications. There are no runtimes required! And, there is no rewriting, which minimizes the time investment and the risk of error.

XML Thunder’s benefits include:
For more information about how you can work smarter to modernize your legacy applications for XML, please contact us at