stringify Function

private pure function stringify(self) result(string)

Arguments

Type IntentOptional AttributesName
class(xml_file), intent(in) :: self

XML file.

Return Value character(len=:), allocatable

Output string containing the whole xml file.

Description

Convert the whole file data into a string.


Variables

TypeVisibility AttributesNameInitial
character(len=:), public, allocatable:: tag_string

Output string containing the current tag.

integer(kind=I4P), public :: t

Counter.


Source Code

  pure function stringify(self) result(string)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Convert the whole file data into a string.
  !---------------------------------------------------------------------------------------------------------------------------------
  class(xml_file), intent(in)   :: self       !< XML file.
  character(len=:), allocatable :: string     !< Output string containing the whole xml file.
  character(len=:), allocatable :: tag_string !< Output string containing the current tag.
  integer(I4P)                  :: t          !< Counter.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  string = ''
  if (self%Nt>0) then
    do t=1, self%Nt - 1
      tag_string = self%tag(t)%stringify()
      string = string//tag_string//new_line('a')
    enddo
    tag_string = self%tag(self%Nt)%stringify()
    string = string//tag_string
  endif
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction stringify