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)

Write tag to unit file.

Type Bound

xml_tag

Arguments

Type IntentOptional Attributes Name
class(xml_tag), intent(in) :: self

XML tag.

integer(kind=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(len=*), intent(in), optional :: form

Format.

character(len=*), 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(kind=I4P), intent(out), optional :: iostat

IO status.

character(len=*), intent(out), optional :: iomsg

IO message.


Calls

proc~~write_tag~~CallsGraph proc~write_tag xml_tag%write_tag chars chars proc~write_tag->chars proc~stringify xml_tag%stringify proc~write_tag->proc~stringify upper upper proc~write_tag->upper proc~stringify->chars is_allocated is_allocated proc~stringify->is_allocated proc~end_tag xml_tag%end_tag proc~stringify->proc~end_tag proc~self_closing_tag xml_tag%self_closing_tag proc~stringify->proc~self_closing_tag proc~start_tag xml_tag%start_tag proc~stringify->proc~start_tag

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