subroutine dump_annotation(xf,annotation)
use xmlf90_wxml
use m_psml_assoc_list, only: ps_annotation_t => assoc_list_t
use m_psml_assoc_list, only: nitems_annotation => assoc_list_nitems
use m_psml_assoc_list, only: get_annotation_key => assoc_list_get_key
use m_psml_assoc_list, only: get_annotation_value => assoc_list_get_value
type(xmlf_t), intent(inout) :: xf
type(ps_annotation_t), intent(in) :: annotation
integer :: n_items, i, stat
character(len=256) :: key, val
n_items = nitems_annotation(annotation)
if (n_items > 0) then
call xml_NewElement(xf,"annotation")
do i = 1, n_items
call get_annotation_key(annotation,i,key,stat)
call get_annotation_value(annotation,i,val,stat)
call my_add_attribute(xf,trim(key),trim(val))
enddo
call xml_EndElement(xf,"annotation")
endif
end subroutine dump_annotation