save_annotation Subroutine

private subroutine save_annotation(atts, annotation)

Uses

Arguments

Type IntentOptional Attributes Name
type(dictionary_t), intent(in) :: atts
type(assoc_list_t), intent(out) :: annotation

Contents

Source Code


Source Code

subroutine save_annotation(atts,annotation)
  use m_psml_assoc_list, ps_annotation_t => assoc_list_t
  use xmlf90_sax, only: dictionary_t, get_value, get_key, len

       type(dictionary_t), intent(in) :: atts
       type(ps_annotation_t), intent(out) :: annotation
       
       integer :: n, i, status
       character(len=300) :: key, value

       n = len(atts)
       call assoc_list_init(annotation,n,status)
       if (status /= 0) call die("Failed to init annotation object")
       do i = 1, n
          call get_key(atts,i,key,status)
          if (status /= 0) call die("cannot get key in atts dict")
          call get_value(atts,i,value,status)
          if (status /= 0) call die("cannot get value in atts dict")
          call assoc_list_insert(annotation,key,value,status)
          if (status /= 0) call die("Failed to insert annotation pair")
       enddo
     end subroutine save_annotation