is_attribute_present Function

private pure function is_attribute_present(self, name) result(is_present)

Arguments

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

XML tag.

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

Attribute name.

Return Value logical

Inquire result.

Description

Return .true. it the queried attribute name is defined, .false. otherwise.


Variables

TypeVisibility AttributesNameInitial
integer(kind=I4P), public :: a

Counter.


Source Code

  pure function is_attribute_present(self, name) result(is_present)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Return .true. it the queried attribute name is defined, .false. otherwise.
  !---------------------------------------------------------------------------------------------------------------------------------
  class(xml_tag), intent(in) :: self       !< XML tag.
  character(*),   intent(in) :: name       !< Attribute name.
  logical                    :: is_present !< Inquire result.
  integer(I4P)               :: a          !< Counter.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  is_present = .false.
  if (self%attributes_number>0) then
    do a=1, self%attributes_number
      if (self%attribute(1, a)==name) then
        is_present = .true.
        exit
      endif
    enddo
  endif
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction is_attribute_present