write_tag Subroutine

private subroutine write_tag(self, unit, is_indented, is_content_indented, form, end_record, only_start, only_content, only_end, iostat, iomsg)

Arguments

TypeIntentOptionalAttributesName
class(xml_tag), intent(in) :: self
integer(kind=I4P), intent(in) :: unit
logical, intent(in), optional :: is_indented
logical, intent(in), optional :: is_content_indented
character, intent(in), optional :: form
character, intent(in), optional :: end_record
logical, intent(in), optional :: only_start
logical, intent(in), optional :: only_content
logical, intent(in), optional :: only_end
integer(kind=I4P), intent(out), optional :: iostat
character, intent(out), optional :: iomsg

Contents

Source Code


Source Code

  subroutine write_tag(self, unit, is_indented, is_content_indented, form, end_record, only_start, only_content, only_end, &
                       iostat, iomsg)
  !< Write tag to unit file.
  class(xml_tag), intent(in)            :: self                !< XML tag.
  integer(I4P),   intent(in)            :: unit                !< File unit.
  logical,        intent(in),  optional :: is_indented         !< Activate content indentation.
  logical,        intent(in),  optional :: is_content_indented !< Activate content indentation.
  character(*),   intent(in),  optional :: form                !< Format.
  character(*),   intent(in),  optional :: end_record          !< Ending record.
  logical,        intent(in),  optional :: only_start          !< Write only start tag.
  logical,        intent(in),  optional :: only_content        !< Write only content.
  logical,        intent(in),  optional :: only_end            !< Write only end tag.
  integer(I4P),   intent(out), optional :: iostat              !< IO status.
  character(*),   intent(out), optional :: iomsg               !< IO message.
  type(string)                          :: form_               !< Format.
  type(string)                          :: end_record_         !< Ending record.
  integer(I4P)                          :: iostat_             !< IO status.
  character(500)                        :: iomsg_              !< IO message.

  form_ = 'UNFORMATTED'
  if (present(form)) then
    form_ = form
    form_ = form_%upper()
  endif
  end_record_ = '' ; if (present(end_record)) end_record_ = end_record
  select case(form_%chars())
  case('UNFORMATTED')
    write(unit=unit, iostat=iostat_, iomsg=iomsg_)self%stringify(is_indented=is_indented,                 &
                                                                 is_content_indented=is_content_indented, &
                                                                 only_start=only_start,                   &
                                                                 only_content=only_content,               &
                                                                 only_end=only_end)//end_record_
  case('FORMATTED')
    write(unit=unit, fmt='(A)', iostat=iostat_, iomsg=iomsg_)self%stringify(is_indented=is_indented,                 &
                                                                            is_content_indented=is_content_indented, &
                                                                            only_start=only_start,                   &
                                                                            only_content=only_content,               &
                                                                            only_end=only_end)//end_record_
  endselect
  if (present(iostat)) iostat = iostat_
  if (present(iomsg)) iomsg = iomsg_
  endsubroutine write_tag