get_value Subroutine

private elemental subroutine get_value(self, source)

Get the tag value from source after tag_name has been set.

Type Bound

xml_tag

Arguments

Type IntentOptional Attributes Name
class(xml_tag), intent(inout) :: self

XML tag.

character(len=*), intent(in) :: source

String containing data.


Called by

proc~~get_value~~CalledByGraph proc~get_value xml_tag%get_value proc~get xml_tag%get proc~get->proc~get_value proc~parse xml_tag%parse proc~parse->proc~get proc~search xml_tag%search proc~search->proc~parse program~foxy_test_create_tag foxy_test_create_tag program~foxy_test_create_tag->proc~parse proc~get_content xml_tag%get_content proc~get_content->proc~search proc~content xml_file%content proc~content->proc~get_content

Source Code

   elemental subroutine get_value(self, source)
   !< Get the tag value from source after tag_name has been set.
   class(xml_tag), intent(inout) :: self   !< XML tag.
   character(*),   intent(in)    :: source !< String containing data.
   integer                       :: c1     !< Counter.
   integer                       :: c2     !< Counter.

   call self%tag_content%free
   self%is_self_closing = .false.
   if (index(string=source, substring='<'//self%tag_name)>0) then
      c2 = index(string=source, substring='</'//self%tag_name//'>')
      if (c2>0) then ! parsing tag value
         c1 = index(string=source, substring='>')
         if (c1+1<c2-1) self%tag_content = source(c1+1:c2-1)
      else
         self%is_self_closing = .true.
      endif
   endif
   endsubroutine get_value