Skip to content

FoXyFortran XML Parser

A KISS pure Fortran library for parsing and emitting XML files and tags.

Quick start โ€‹

Parse an XML string and query a tag's content:

fortran
use foxy, only: xml_file
type(xml_file)                :: xfile
character(len=:), allocatable :: val

call xfile%parse(string= &
  '<config>'//new_line('A')// &
  '  <dt unit="s">0.01</dt>'//new_line('A')// &
  '  <nstep>1000</nstep>'//new_line('A')// &
  '</config>')

val = xfile%content('dt')
print *, val   ! 0.01

Create and emit a tag programmatically:

fortran
use foxy, only: xml_tag
type(xml_tag) :: tag

tag = xml_tag(name='point', &
              attributes=reshape([['x','1'],['y','2'],['z','3']], [2,3]))
print *, tag%stringify()   ! <point x="1" y="2" z="3"/>

Authors โ€‹

Contributions are welcome โ€” see the Contributing page.

Copyrights โ€‹

FoXy is distributed under a multi-licensing system:

Use caseLicense
FOSS projectsGPL v3
Closed source / commercialBSD 2-Clause
Closed source / commercialBSD 3-Clause
Closed source / commercialMIT

Anyone interested in using, developing, or contributing to FoXy is welcome โ€” pick the license that best fits your needs.