...
Code Block |
---|
<xs:element name="parameters"> <xs:complexType> <xs:all> <xs:element name="integer"> <xs:all> <xs:element name="node" type="xs:integer"/> </xs:all> </xs:element> <xs:element name="float"> <xs:all> <xs:element name="node" type="xs:float"/> </xs:all> </xs:complexType> </xs:all> </xs:complexType> </xs:element> |
Interfaces
The interfaces provided in XMLLIB includes both subroutines to read input files to a buffer and to parse these, i.e. extract values from the data.
Reading input files
The XMLLIB was originally built for EFDA-ITM (later EUROfusion/WPCD) datastructures called CPOs and later adapted for the ITER/IMAS datastructures, called IDSs.
In both these dataformats a string is referred to as an array of 132-bit characters, i.e. character(len=132), pointer, dimension(:)
. Consequently the XMLLIB represent the xml the same way, as an CPO or IDS string.
There are two interfaces for reading xml input files. The first one reads a single file into a buffer:
Code Block |
---|
use f90_file_reader, only: file2buffer
character(len=132), pointer :: buffer(:) => NULL()
integer :: io_unit = 1
call file2buffer('data.xml', io_unit, buffer) |
The second interface reads three files, an xml file, a schema file and a default or reference xml file, into three buffers, param_xml
, param_xsd
and param_default
.
Code Block |
---|
use xml_file_reader, only: fill_param
character(132), pointer :: param_xml(:) => NULL()
character(132), pointer :: param_xsd(:) => NULL()
character(132), pointer :: param_default(:) => NULL()
call fill_param( param_xml , param_xsd , param_default , &
'input.xml' , 'input.xsd' , 'input_default.xml' ) |
The second design of the second interface is motivated by the CPO and IDS data structures includes three files as described above. As an example the IDS derived type ids_parameters_input
includes the three strings parameters_value
, schema
and parameters_default
. The
Code Block |
---|
type(ids_parameters_input), intent(in) :: codeparam
call file2buffer('input.xml', 'input.xsd', 'input_default.xml', &
codeparam%parameters_value, codeparam%schema, codeparam%parameters_default) |