FoX: A Fortran library for XML processing

FoX (Fortran XML) is a library, written entirely in Fortran, designed to allow the easy use of XML from Fortran programs.

Purpose, Installations and Licensing

FoX is a set of Fortran libraries for processing of XML files. It supports the following interfaces:

  • streaming output of well-formed XML (1.0 or 1.1)

  • domain-specific high-level APIs (CMLComp, KML)

  • a fully validating XML 1.0/1.1 parser

  • support for SAX and DOM

FoX is available on all HPC systems at LRZ.

FoX is distributed under the terms of a BSD-like License.

Documentation

Usage

Using FoX requires

  • A Fortran client program

  • Intel's Fortran compiler, version 11.1 or higher

Accessing FoX

Access to the FoX installations on LRZ HPC systems is provided via the environment module fox:

module load fox

This will set all required environment variables.
The module information files are accessed via the $FOX_INC variable; inside your Fortran program you need to reference the modules via a use statement. Here is a simple example program:

program test_xml
   use fox_wxml
  type(xmlf_t) :: xf
   call xml_openfile('output.xml', xf)
   call xml_newelement(xf,'books')
   call xml_newelement(xf,'book')
   call xml_addattribute(xf,'Title','Harry Potter')
   call xml_addattribute(xf,'Author','J K. Rowling')
   call xml_addattribute(xf,'Year',2005)
   call xml_endelement(xf,'book')
   call xml_endelement(xf,'books')
   call xml_close(xf)
end program

Compilation is performed via

ifort -c $FOX_INC test_xml.f90

and linkage via

ifort -o test_xml.exe test_xml.o $FOX_LIB

The resulting program can then be run by issuing

./test_xml.exe

and produces a file output.xml.