content Function

private pure function content(self, name)

Arguments

TypeIntentOptionalAttributesName
class(xml_file), intent(in) :: self
character, intent(in) :: name

Return Value character(len=:),allocatable


Contents

Source Code


Source Code

  pure function content(self, name)
  !< Return tag content of tag named *name*.
  !<
  !< @note If there is no value, the *tag_content* string is returned empty, but allocated.
  class(xml_file), intent(in)   :: self    !< XML file.
  character(*),    intent(in)   :: name    !< Tag name.
  character(len=:), allocatable :: content !< Tag content.
  integer(I4P)                  :: t       !< Counter.

  if (allocated(content)) deallocate(content)
  if (self%Nt>0) then
    do t=1, self%Nt
      call self%tag(t)%get_content(name=name, content=content)
      if (allocated(content)) exit
    enddo
  endif
  if (.not.allocated(content)) content = ''
  endfunction content