XML file class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=I4P), | private | :: | Nt | = | 0 | Number of XML tags. |
|
type(xml_tag), | private, | allocatable | :: | tag(:) | XML tags array. |
Free dynamic memory.
Parse xml data from string or file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(inout) | :: | self | XML file. |
||
character(len=*), | intent(in), | optional | :: | string | String containing xml data. |
|
character(len=*), | intent(in), | optional | :: | filename | File name containing xml data. |
Parse xml data from string or file.
Return tag content of tag named name.
Convert the whole file data into a string.
Add tag to XML file.
Add tag from XML file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(inout) | :: | self | XML file. |
||
character(len=*), | intent(in) | :: | name | XML tag name. |
Delete tag from XML file.
Parse xml data from string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_file), | intent(inout) | :: | self | XML file. |
||
character(len=*), | intent(in) | :: | source_string | String containing xml data. |
Parse xml data from string.
type, public:: xml_file
!< XML file class.
!<
!< @todo The "delete" facility is incomplete: nested tags are not taken into account. Better support will with the
!< "dom" facility.
private
integer(I4P) :: Nt = 0 !< Number of XML tags.
type(xml_tag), allocatable :: tag(:) !< XML tags array.
contains
! public methods
procedure :: free !< Free dynamic memory.
final :: finalize !< Free dynamic memory when finalizing.
procedure :: parse !< Parse xml data from string or file.
procedure :: content !< Return tag content of tag named *name*.
procedure :: stringify !< Convert the whole file data into a string.
procedure :: add_tag !< Add tag to XML file.
procedure :: delete_tag !< Add tag from XML file.
! private methods
procedure, private :: parse_from_string !< Parse xml data from string.
endtype xml_file