set Subroutine

private 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.

Type Bound

xml_tag

Arguments

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

XML tag.

character(len=*), intent(in), optional :: name

Tag name.

character(len=*), intent(in), optional :: attribute(1:)

Attribute name/value pair [1:2].

character(len=*), intent(in), optional :: attributes(1:,1:)

Attributes list of name/value pairs [1:2,1:].

character(len=*), intent(in), optional :: attributes_stream

Attributes list of name/value pairs as stream.

logical, intent(in), optional :: sanitize_attributes_value

Sanitize attributes value.

character(len=*), intent(in), optional :: content

Tag value.

integer(kind=I4P), intent(in), optional :: pos(1:)

Characters position (in source) indexes.

integer(kind=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(kind=I4P), intent(in), optional :: id

Uniq ID.

integer(kind=I4P), intent(in), optional :: level

Tag hierarchy level.

integer(kind=I4P), intent(in), optional :: parent_id

Parent uniq ID.

character(len=:), intent(in), optional, allocatable :: attributes_stream_alloc

Attributes list stream, allocatable input.

character(len=:), intent(in), optional, allocatable :: content_alloc

Tag value, allocatable input.


Calls

proc~~set~~CallsGraph proc~set xml_tag%set proc~add_multiple_attributes xml_tag%add_multiple_attributes proc~set->proc~add_multiple_attributes proc~add_single_attribute xml_tag%add_single_attribute proc~set->proc~add_single_attribute proc~add_stream_attributes xml_tag%add_stream_attributes proc~set->proc~add_stream_attributes proc~add_multiple_attributes->proc~add_single_attribute proc~alloc_attributes xml_tag%alloc_attributes proc~add_single_attribute->proc~alloc_attributes proc~add_stream_attributes->proc~add_single_attribute fill fill proc~add_stream_attributes->fill partition partition proc~add_stream_attributes->partition slice slice proc~add_stream_attributes->slice

Called by

proc~~set~~CalledByGraph proc~set xml_tag%set proc~create_tag_flat create_tag_flat proc~create_tag_flat->proc~set proc~create_tag_nested create_tag_nested proc~create_tag_nested->proc~set proc~parse_from_string xml_file%parse_from_string proc~parse_from_string->proc~set program~foxy_test_create_tag foxy_test_create_tag program~foxy_test_create_tag->proc~set interface~xml_tag xml_tag interface~xml_tag->proc~create_tag_flat interface~xml_tag->proc~create_tag_nested proc~parse~2 xml_file%parse proc~parse~2->proc~parse_from_string program~foxy_test_delete_tag foxy_test_delete_tag program~foxy_test_delete_tag->proc~parse~2 program~foxy_test_parse_file_simple foxy_test_parse_file_simple program~foxy_test_parse_file_simple->proc~parse~2 program~foxy_test_parse_string_nested_tags foxy_test_parse_string_nested_tags program~foxy_test_parse_string_nested_tags->proc~parse~2 program~foxy_test_parse_string_simple foxy_test_parse_string_simple program~foxy_test_parse_string_simple->proc~parse~2 program~foxy_test_write_tag foxy_test_write_tag program~foxy_test_write_tag->proc~parse~2

Source Code

   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