get_content Subroutine

private pure subroutine get_content(self, name, content)

Type Bound

xml_tag

Arguments

Type IntentOptional Attributes Name
class(xml_tag), intent(in) :: self
character(len=*), intent(in) :: name
character(len=:), intent(out), allocatable :: content

Calls

proc~~get_content~~CallsGraph proc~get_content xml_tag%get_content proc~chars string%chars proc~get_content->proc~chars proc~is_allocated string%is_allocated proc~get_content->proc~is_allocated proc~search xml_tag%search proc~get_content->proc~search proc~search->proc~is_allocated proc~parse xml_tag%parse proc~search->proc~parse proc~parse->proc~is_allocated proc~get xml_tag%get proc~parse->proc~get proc~parse_attributes_names xml_tag%parse_attributes_names proc~parse->proc~parse_attributes_names proc~parse_tag_name xml_tag%parse_tag_name proc~parse->proc~parse_tag_name proc~get_attributes xml_tag%get_attributes proc~get->proc~get_attributes proc~get_value xml_tag%get_value proc~get->proc~get_value proc~alloc_attributes xml_tag%alloc_attributes proc~parse_attributes_names->proc~alloc_attributes

Called by

proc~~get_content~~CalledByGraph proc~get_content xml_tag%get_content proc~content xml_file%content proc~content->proc~get_content

Source Code

  pure subroutine get_content(self, name, content)
  !< Return tag content of self (or its nested tags) if named *name*.
  !<
  !< @note If there is no value, the *content* string is returned deallocated.
  class(xml_tag),                intent(in)  :: self    !< XML tag.
  character(*),                  intent(in)  :: name    !< Searched tag name.
  character(len=:), allocatable, intent(out) :: content !< Tag content.
  type(xml_tag)                              :: tag     !< Dummy XML tag.

  if (allocated(content)) deallocate(content)
  if (self%tag_name%is_allocated()) then
    if (self%tag_name==name) then
      if (self%tag_content%is_allocated()) content = self%tag_content%chars()
    else
      if (self%tag_content%is_allocated()) then
        call tag%search(tag_name=name, source=self%tag_content%chars())
        if (tag%tag_content%is_allocated()) content = tag%tag_content%chars()
      endif
    endif
  endif
  endsubroutine get_content