pure subroutine set(self, name, attribute, attributes, attributes_stream, sanitize_attributes_value, content, &
pos, indent, is_content_indented, is_self_closing, id, level, parent_id, &
attributes_stream_alloc, content_alloc)
!< Set tag data.
class(xml_tag), intent(inout) :: self !< XML tag.
character(*), intent(in), optional :: name !< Tag name.
character(*), intent(in), optional :: attribute(1:) !< Attribute name/value pair [1:2].
character(*), intent(in), optional :: attributes(1:,1:) !< Attributes list of name/value pairs [1:2,1:].
character(*), intent(in), optional :: attributes_stream !< Attributes list of name/value pairs as stream.
logical, intent(in), optional :: sanitize_attributes_value !< Sanitize attributes value.
character(*), intent(in), optional :: content !< Tag value.
integer(I4P), intent(in), optional :: pos(1:) !< Characters position (in source) indexes.
integer(I4P), intent(in), optional :: indent !< Number of indent-white-spaces.
logical, intent(in), optional :: is_content_indented !< Activate value indentation.
logical, intent(in), optional :: is_self_closing !< The tag is self closing.
integer(I4P), intent(in), optional :: id !< Uniq ID.
integer(I4P), intent(in), optional :: level !< Tag hierarchy level.
integer(I4P), intent(in), optional :: parent_id !< Parent uniq ID.
character(:), allocatable, intent(in), optional :: attributes_stream_alloc !< Attributes list stream, allocatable input.
character(:), allocatable, intent(in), optional :: content_alloc !< Tag value, allocatable input.
logical :: is_content_indented_ !< Activate value indentation.
is_content_indented_ = .false. ; if (present(is_content_indented)) is_content_indented_ = is_content_indented
if (present(name)) self%tag_name = name
if (present(attribute)) call self%add_single_attribute(attribute=attribute, sanitize_value=sanitize_attributes_value)
if (present(attributes)) call self%add_multiple_attributes(attributes=attributes, sanitize_values=sanitize_attributes_value)
if (present(attributes_stream)) call self%add_stream_attributes(attributes_stream=attributes_stream, &
sanitize_values=sanitize_attributes_value)
if (present(pos)) self%pos = pos
if (present(indent)) self%indent = indent
if (present(content)) then
if (is_content_indented_) then
self%tag_content = new_line('a')//repeat(' ', self%indent+2)//content//new_line('a')
else
self%tag_content = content
endif
endif
if (present(is_self_closing)) self%is_self_closing = is_self_closing
if (present(id)) self%id = id
if (present(level)) self%level = level
if (present(parent_id)) self%parent_id = parent_id
if (present(attributes_stream_alloc)) then
if (allocated(attributes_stream_alloc)) call self%add_stream_attributes(attributes_stream=attributes_stream_alloc, &
sanitize_values=sanitize_attributes_value)
endif
if (present(content_alloc)) then
if (allocated(content_alloc)) then
if (is_content_indented_) then
self%tag_content = new_line('a')//repeat(' ', self%indent+2)//content_alloc//new_line('a')
else
self%tag_content = content_alloc
endif
endif
endif
endsubroutine set