assign_tag Subroutine

private elemental subroutine assign_tag(lhs, rhs)

Arguments

TypeIntentOptionalAttributesName
class(xml_tag), intent(inout) :: lhs
type(xml_tag), intent(in) :: rhs

Contents

Source Code


Source Code

  elemental subroutine assign_tag(lhs, rhs)
  !< Assignment between two tags.
  class(xml_tag), intent(inout) :: lhs !< Left hand side.
  type(xml_tag),  intent(in)    :: rhs !< Right hand side.
  integer(I4P)                  :: a   !< Counter.

  call lhs%free
  if (rhs%tag_name%is_allocated()) lhs%tag_name = rhs%tag_name
  if (rhs%tag_content%is_allocated()) lhs%tag_content = rhs%tag_content
  if (rhs%attributes_number>0) then
    allocate(lhs%attribute(1:2, 1:rhs%attributes_number))
    do a=1, rhs%attributes_number
      lhs%attribute(1:2, a) = rhs%attribute(1:2, a)
    enddo
  endif
  lhs%attributes_number = rhs%attributes_number
  lhs%indent = rhs%indent
  lhs%is_self_closing = rhs%is_self_closing
  endsubroutine assign_tag