Accessing XML files from Fortran

At this moment, XML is a very popular and widespread format for storing data in a portable and easily accessible way. There are many libraries available in languages like C, C++ and Java to read and otherwise manipulate such files and their contents. For Fortran programmers, sofar, there have been few options: accessing such files via a C library is one possibility, but this has as a consequence that you need the right combination of compilers. It also means that you need to adapt to the way that particular library works - and that can be awkward.

With the XML parser that is provided here Fortran programmers have an all-Fortran solution for reading and writing XML files. The current implementation does not provide the full set of possibilities that XML offers, but then there are few if any libraries in existence that do. (See the documentation for more information on these limitations).

What the library does provide is the possibility to use XML files in four different ways:

The source code is available via the xml-fortran project on SourceForge.

Current version: 1.00 - april 2008

Besides the plain library to read XML files, I have also written a program, called "xmlreader" that takes a data definition in the form of a simple XML file and turns that into a complete Fortran 90 module that can read XML files with the specified structure. The variables you define via the XML file (both scalar and array variables of basic types or derived types) are automatically declared and dealt with in the generated code.

Jacques Germishuizen has contributed a tutorial which will enable you to get acquainted with the library and the "xmlreader" program.


New features and bug fixes in version 1.00 (april 2008):
April, 2008 - Arjen Markus