Data files in general, and XML files in particular, can be generally be used in three different ways: All three approaches are supported with the XML-Fortran library. They will be elaborated on below.

Reading XML files from top to bottom

The XML parser module is based on the concept of SAX, but it works by letting the program read the XML file piece by piece, instead of via call-back routines. In fact it is very much like the way you would use READ statements to read the file:
   call xml_open( info, .... )

      ! Get the next tag and the associated data
      call xml_get( info, .... )
      ! Check if we have reached the end of the file or not
      if ( .not. xml_ok(info) ) exit

      ! Handle the attributes and data for this tag

   ! End of file
   call xml_close( info )

Storing XML files in a hierarchical data structure

Via the tree module you can load the contents of the XML file into a tree structure and use that to query the data later on.

To be expanded ...

Generating reader routines

A completely different approach is to use a description of the variables you want to read in via an XML file, to actually generate the code to do so. This is the purpose of the xmlreader program, which is currently (september 2005) under development. The idea is that in many cases you need to load all the data contained in the XML file and then use them in the program, in other words, the data you expect are a fixed collection. Hence, the code to read the data from the file can be generated automatically, provided you describe it accurately.