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.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=:), | public, | allocatable | :: | source | String containing xml data. |
subroutine parse(self, string, filename)
!---------------------------------------------------------------------------------------------------------------------------------
!< Parse xml data from string or file.
!<
!< @note Self data are free before trying to parse new xml data: all previously parsed data are lost.
!---------------------------------------------------------------------------------------------------------------------------------
class(xml_file), intent(inout) :: self !< XML file.
character(*), optional, intent(in) :: string !< String containing xml data.
character(*), optional, intent(in) :: filename !< File name containing xml data.
character(len=:), allocatable :: source !< String containing xml data.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
call self%free
if (present(string)) then
call self%parse_from_string(source_string=string)
elseif (present(filename)) then
source = load_file_as_stream(filename=filename, fast_read=.true.)
call self%parse_from_string(source_string=source)
endif
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine parse