![]() |
The Open FUSION Toolkit 1.0.0-6f445ef
An open-source framework for fusion and plasma science and engineering
|
Libxml2 DOM interface for OFT.
Provides a limited interface between Libxml2 and Fortran using iso_c_binding for DOM-style XML access, along with helper routines for parsing string content into typed Fortran values. Data stored in XML nodes/attributes can be either space-delimited or comma-delimited with newlines to denote 2D arrays.
Data Types | |
| interface | oft_xml_free_doc_c |
| Free an XML document previously parsed with oft_xml_load_file_c. More... | |
| interface | oft_xml_free_ptr_c |
| Free c objects, for example arrays returned by oft_xml_get_elements_c or strings returned by oft_xml_get_content_c. More... | |
| interface | oft_xml_get_attribute_c |
| Extract content from an attribute on a given xml node as a string. More... | |
| interface | oft_xml_get_content_c |
| Extract content from a given xml node as a string. More... | |
| interface | oft_xml_get_element_c |
| Retrieve a pointer to the i-th xml node with a given name inside a parent node. More... | |
| interface | oft_xml_get_elements_c |
| Retrieve pointers to all xml nodes with a given name inside a parent node. More... | |
| interface | oft_xml_get_root_c |
| Retrieve a pointer to the root element of an xmlDoc object. More... | |
| interface | oft_xml_has_attribute_c |
| Test if a given xml node has a given attribute. More... | |
| interface | oft_xml_parse_file_c |
| Parse an XML file from a given file path, returning a pointer to the corresponding xmlDoc. More... | |
| type | xml_doc |
| XML document wrapper. More... | |
| type | xml_exception |
| interface | xml_get_element |
| Get one or more elements by name from a parent node. More... | |
| type | xml_node |
| Libxml2 node wrapper. More... | |
| type | xml_nodelist |
| List of XML nodes. More... | |
| interface | xml_read_attribute |
| Extract content of a given type from an attribute on an XML node. More... | |
| interface | xml_read_content |
| Extract content of a given type from an XML node. More... | |
Functions/Subroutines | |
| subroutine | normalize_string (content_in, content_out) |
| Normalize a string by removing leading/trailing whitespace and blank/comment lines. | |
| subroutine | oft_xml_free (doc_ptr) |
| Free an XML document previously parsed with oft_xml_load. | |
| subroutine | oft_xml_get_attr (node, attr_name, content, ierr) |
| Extract content from a specified attribute on a given xml node into a Fortran string. | |
| subroutine | parse_string_to_doubles (content, output, output_shape, ierr) |
| Parse string content into a 1D array of double precision values with shape information. | |
| subroutine | parse_string_to_integers (content, output, output_shape, ierr) |
| Parse string content into a 1D array of integer values with shape information. | |
| subroutine | parse_string_to_logicals (content, output, output_shape, ierr) |
| Parse string content into a 1D array of logical values with shape information. | |
| subroutine | tokenize_string (content, tokens, ierr) |
| Find token boundaries in a string containing comma-delimited and/or newline-delimited values to be parsed into typed Fortran values. | |
| subroutine | xml_clear_exceptions () |
| Clear messages from the exception stack. | |
| subroutine | xml_extractdataattribute_double (node, attr_name, output, output_shape, iostat) |
| Parse a single double precision value from an XML attribute's content. | |
| subroutine | xml_extractdataattribute_double1d (node, attr_name, output, output_shape, iostat) |
| Parse XML attribute content into a 1D array of double precision values. | |
| subroutine | xml_extractdataattribute_double2d (node, attr_name, output, output_shape, iostat) |
| Parse XML attribute content into a 2D array of double precision values. | |
| subroutine | xml_extractdataattribute_int (node, attr_name, output, output_shape, iostat) |
| Parse a single integer value from an XML attribute's content. | |
| subroutine | xml_extractdataattribute_int1d (node, attr_name, output, output_shape, iostat) |
| Parse XML attribute content into a 1D array of integer values. | |
| subroutine | xml_extractdataattribute_int2d (node, attr_name, output, output_shape, iostat) |
| Parse XML attribute content into a 2D array of integer values. | |
| subroutine | xml_extractdataattribute_logical (node, attr_name, output, output_shape, iostat) |
| Parse a single logical value from an XML attribute's content. | |
| subroutine | xml_extractdataattribute_logical1d (node, attr_name, output, output_shape, iostat) |
| Parse XML attribute content into a 1D array of logical values. | |
| subroutine | xml_extractdataattribute_logical2d (node, attr_name, output, output_shape, iostat) |
| Parse XML attribute content into a 2D array of logical values. | |
| subroutine | xml_extractdataattribute_string (node, attr_name, output, iostat) |
| Get content from an XML attribute as a string. | |
| subroutine | xml_extractdatacontent_double (node, output, output_shape, iostat) |
| Parse a single double precision value from an XML node's content. | |
| subroutine | xml_extractdatacontent_double1d (node, output, output_shape, iostat) |
| Parse XML content into a 1D array of double precision values. | |
| subroutine | xml_extractdatacontent_double2d (node, output, output_shape, iostat) |
| Parse XML content into a 2D array of double precision values. | |
| subroutine | xml_extractdatacontent_int (node, output, output_shape, iostat) |
| Parse XML content into a single integer value. | |
| subroutine | xml_extractdatacontent_int1d (node, output, output_shape, iostat) |
| Parse XML content into a 1D array of integer values. | |
| subroutine | xml_extractdatacontent_int2d (node, output, output_shape, iostat) |
| Parse XML content into a 2D array of integer values. | |
| subroutine | xml_extractdatacontent_logical (node, output, output_shape, iostat) |
| Parse XML content into a single logical value. | |
| subroutine | xml_extractdatacontent_logical1d (node, output, output_shape, iostat) |
| Parse XML content into a 1D array of logical values. | |
| subroutine | xml_extractdatacontent_logical2d (node, output, output_shape, iostat) |
| Parse XML content into a 2D array of logical values. | |
| subroutine | xml_extractdatacontent_string (node, output, iostat) |
| Get content from an XML node as a string. | |
| subroutine | xml_get_content (node, content, ierr) |
| Extract content from a given xml node into a Fortran string. | |
| subroutine | xml_get_element_list (parent, name, elements, error_flag) |
| Retrieve all xml nodes with a given name contained within a parent node. | |
| subroutine | xml_get_element_single (parent, name, element, error_flag, index) |
| Retrieve the i-th xml node with a given name contained within a parent node. | |
| logical function | xml_hasattribute (node, attr_name) |
| Test if a given xml node has a specified attribute. | |
| logical function | xml_node_associated (self) |
Check if an xml_node is associated with a C object. | |
| subroutine | xml_parsefile (filepath, doc, ierr) |
| Parse an XML file. | |
| subroutine | xml_print_exceptions () |
| Print messages from the exception stack. | |
| subroutine | xml_set_exception (message) |
| Add exception to the exception stack. | |
Variables | |
| integer(i4) | xml_exception_depth = 0 |
| Exception stack depth (0 if no exceptions) | |
| type(xml_exception), dimension(10) | xml_exceptions |
| Stack of excepton messages. | |
| subroutine normalize_string | ( | character(len=*), intent(in) | content_in, |
| character(len=:), intent(out), allocatable | content_out | ||
| ) |
Normalize a string by removing leading/trailing whitespace and blank/comment lines.
| [in] | content_in | Input string |
| [out] | content_out | Output string |
| subroutine oft_xml_free | ( | type(c_ptr), intent(inout) | doc_ptr | ) |
Free an XML document previously parsed with oft_xml_load.
| [in,out] | doc_ptr | C pointer to xmlDoc to free |
| subroutine oft_xml_get_attr | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| character(len=:), intent(out), allocatable | content, | ||
| integer(i4), intent(out) | ierr | ||
| ) |
Extract content from a specified attribute on a given xml node into a Fortran string.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | content | Output string |
| [out] | ierr | Error flag (0 on success) |
| subroutine parse_string_to_doubles | ( | character(len=*), intent(inout) | content, |
| real(r8), dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out) | ierr | ||
| ) |
Parse string content into a 1D array of double precision values with shape information.
| [in,out] | content | Input string |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | ierr | Error flag (0 on success) |
| subroutine parse_string_to_integers | ( | character(len=*), intent(inout) | content, |
| integer(i4), dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out) | ierr | ||
| ) |
Parse string content into a 1D array of integer values with shape information.
| [in,out] | content | Input string |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | ierr | Error flag (0 on success) |
| subroutine parse_string_to_logicals | ( | character(len=*), intent(inout) | content, |
| logical, dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out) | ierr | ||
| ) |
Parse string content into a 1D array of logical values with shape information.
Supported values are:
| [in,out] | content | Input string |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | ierr | Error flag (0 on success) |
| subroutine tokenize_string | ( | character(len=*), intent(inout) | content, |
| integer(i4), dimension(:,:,:), intent(out), allocatable | tokens, | ||
| integer(i4), intent(out) | ierr | ||
| ) |
Find token boundaries in a string containing comma-delimited and/or newline-delimited values to be parsed into typed Fortran values.
| [in,out] | content | Input string |
| [out] | tokens | String tokens as (start,end) indices for each column and row |
| [out] | ierr | Error flag (0 on success) |
| subroutine xml_clear_exceptions |
Clear messages from the exception stack.
| subroutine xml_extractdataattribute_double | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| real(r8), intent(out) | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse a single double precision value from an XML attribute's content.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output value |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_double1d | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| real(r8), dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML attribute content into a 1D array of double precision values.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_double2d | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| real(r8), dimension(:,:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML attribute content into a 2D array of double precision values.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_int | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| integer(i4), intent(out) | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse a single integer value from an XML attribute's content.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output value |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_int1d | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| integer(i4), dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML attribute content into a 1D array of integer values.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_int2d | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| integer(i4), dimension(:,:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML attribute content into a 2D array of integer values.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_logical | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| logical, intent(out) | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse a single logical value from an XML attribute's content.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output value |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_logical1d | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| logical, dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML attribute content into a 1D array of logical values.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_logical2d | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| logical, dimension(:,:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML attribute content into a 2D array of logical values.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdataattribute_string | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name, | ||
| character(len=:), intent(inout), allocatable | output, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Get content from an XML attribute as a string.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| [in,out] | output | Output string |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_double | ( | type(xml_node), intent(in) | node, |
| real(r8), intent(out) | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse a single double precision value from an XML node's content.
| [in] | node | XML node |
| [out] | output | Output value |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_double1d | ( | type(xml_node), intent(in) | node, |
| real(r8), dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML content into a 1D array of double precision values.
| [in] | node | XML node |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_double2d | ( | type(xml_node), intent(in) | node, |
| real(r8), dimension(:,:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML content into a 2D array of double precision values.
| [in] | node | XML node |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_int | ( | type(xml_node), intent(in) | node, |
| integer(i4), intent(out) | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML content into a single integer value.
| [in] | node | XML node |
| [out] | output | Output value |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_int1d | ( | type(xml_node), intent(in) | node, |
| integer(i4), dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML content into a 1D array of integer values.
| [in] | node | XML node |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_int2d | ( | type(xml_node), intent(in) | node, |
| integer(i4), dimension(:,:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML content into a 2D array of integer values.
| [in] | node | XML node |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_logical | ( | type(xml_node), intent(in) | node, |
| logical, intent(out) | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML content into a single logical value.
| [in] | node | XML node |
| [out] | output | Output value |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_logical1d | ( | type(xml_node), intent(in) | node, |
| logical, dimension(:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML content into a 1D array of logical values.
| [in] | node | XML node |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_logical2d | ( | type(xml_node), intent(in) | node, |
| logical, dimension(:,:), intent(out), pointer | output, | ||
| integer(i4), dimension(2), intent(out), optional | output_shape, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Parse XML content into a 2D array of logical values.
| [in] | node | XML node |
| [out] | output | Output array |
| [out] | output_shape | Shape of the output array (ncols, nrows) |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_extractdatacontent_string | ( | type(xml_node), intent(in) | node, |
| character(len=:), intent(out), allocatable | output, | ||
| integer(i4), intent(out), optional | iostat | ||
| ) |
Get content from an XML node as a string.
| [in] | node | XML node |
| [out] | output | Output string |
| [out] | iostat | I/O status flag (0 on success) |
| subroutine xml_get_content | ( | type(xml_node), intent(in) | node, |
| character(len=:), intent(out), allocatable | content, | ||
| integer(i4), intent(out) | ierr | ||
| ) |
Extract content from a given xml node into a Fortran string.
| [in] | node | XML node |
| [out] | content | Output string |
| [out] | ierr | Error flag (0 on success) |
| subroutine xml_get_element_list | ( | type(xml_node), intent(in) | parent, |
| character(len=*), intent(in) | name, | ||
| type(xml_nodelist), intent(inout) | elements, | ||
| integer(i4), intent(out) | error_flag | ||
| ) |
Retrieve all xml nodes with a given name contained within a parent node.
| [in] | parent | Parent element |
| [in] | name | Element name to find |
| [in,out] | elements | Found elements |
| [out] | error_flag | Error flag (0 if successful) |
| subroutine xml_get_element_single | ( | type(xml_node), intent(in) | parent, |
| character(len=*), intent(in) | name, | ||
| type(xml_node), intent(out) | element, | ||
| integer(i4), intent(out) | error_flag, | ||
| integer(i4), intent(in), optional | index | ||
| ) |
Retrieve the i-th xml node with a given name contained within a parent node.
| [in] | parent | Parent element |
| [in] | name | Element name to find |
| [out] | element | Found element |
| [out] | error_flag | Error flag (0 if successful) |
| [in] | index | Optional index, defaults to first matching element |
| logical function xml_hasattribute | ( | type(xml_node), intent(in) | node, |
| character(len=*), intent(in) | attr_name | ||
| ) |
Test if a given xml node has a specified attribute.
| [in] | node | XML node |
| [in] | attr_name | Attribute name |
| logical function xml_node_associated | ( | class(xml_node), intent(in) | self | ) |
Check if an xml_node is associated with a C object.
| [in] | self | XML node |
| subroutine xml_parsefile | ( | character(len=*), intent(in) | filepath, |
| type(xml_doc), intent(out) | doc, | ||
| integer(i4), intent(out) | ierr | ||
| ) |
Parse an XML file.
| [in] | filepath | Path to XML file |
| [out] | doc | XML document object |
| [out] | ierr | Error flag (0 on success) |
| subroutine xml_print_exceptions |
Print messages from the exception stack.
| subroutine xml_set_exception | ( | character(len=*), intent(in) | message | ) |
Add exception to the exception stack.
| [in] | message | Exception message |
| integer(i4) xml_exception_depth = 0 |
Exception stack depth (0 if no exceptions)
| type(xml_exception), dimension(10) xml_exceptions |
Stack of excepton messages.