subroutine dump_provenance(xf,p)
use xmlf90_wxml
type(xmlf_t), intent(inout) :: xf
type(provenance_t), pointer :: p
integer :: depth
type(provenance_t), pointer :: q
depth = 0
q => p
do while (associated(q))
depth = depth + 1
q => q%next
enddo
do while (associated(p))
call xml_NewElement(xf,"provenance")
call my_add_attribute(xf,"record-number",str(p%record_number))
call my_add_attribute(xf,"creator",trim(p%creator))
call my_add_attribute(xf,"date",trim(p%date))
call dump_annotation(xf,p%annotation)
if (len(p%input_file%buffer) > 0) then
call xml_NewElement(xf,"input-file")
call my_add_attribute(xf,"name",trim(p%input_file%name))
call xml_AddCDataSection(xf,p%input_file%buffer, &
line_feed=.true.)
call xml_EndElement(xf,"input-file")
endif
call xml_EndElement(xf,"provenance")
p => p%next
end do
end subroutine dump_provenance