Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_tag), | intent(inout) | :: | self | XML tag. |
||
character(len=*), | intent(in) | :: | source | String containing data. |
Get the tag value from source after tag_name has been set.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | c1 | Counter. |
|||
integer, | public | :: | c2 | Counter. |
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