parse_from_string Subroutine

private subroutine parse_from_string(self, source_string)

Type Bound

xml_file

Arguments

Type IntentOptional Attributes Name
class(xml_file), intent(inout) :: self
character(len=*), intent(in) :: source_string

Calls

proc~~parse_from_string~~CallsGraph proc~parse_from_string xml_file%parse_from_string proc~add_tag xml_file%add_tag proc~parse_from_string->proc~add_tag proc~is_parsed xml_tag%is_parsed proc~parse_from_string->proc~is_parsed proc~parse xml_tag%parse proc~parse_from_string->proc~parse proc~is_allocated string%is_allocated proc~is_parsed->proc~is_allocated proc~get xml_tag%get proc~parse->proc~get proc~parse->proc~is_allocated proc~parse_attributes_names xml_tag%parse_attributes_names proc~parse->proc~parse_attributes_names proc~parse_tag_name xml_tag%parse_tag_name proc~parse->proc~parse_tag_name proc~get_attributes xml_tag%get_attributes proc~get->proc~get_attributes proc~get_value xml_tag%get_value proc~get->proc~get_value proc~alloc_attributes xml_tag%alloc_attributes proc~parse_attributes_names->proc~alloc_attributes

Called by

proc~~parse_from_string~~CalledByGraph proc~parse_from_string xml_file%parse_from_string proc~parse~2 xml_file%parse proc~parse~2->proc~parse_from_string program~delete_tag delete_tag program~delete_tag->proc~parse~2 program~parse_file_simple parse_file_simple program~parse_file_simple->proc~parse~2 program~parse_string_simple parse_string_simple program~parse_string_simple->proc~parse~2 program~write_tag write_tag program~write_tag->proc~parse~2

Source Code

  subroutine parse_from_string(self, source_string)
  !< Parse xml data from string.
  class(xml_file), intent(inout) :: self          !< XML file.
  character(*),    intent(in)    :: source_string !< String containing xml data.
  type(xml_tag)                  :: tag           !< Dummy xml tag.
  integer(I4P)                   :: tstart        !< Counter for tracking string parsing.
  integer(I4P)                   :: tend          !< Counter for tracking string parsing.

  tstart = 1
  tend = 0
  do while(tstart<len(source_string))
    call tag%free
    call tag%parse(source=source_string(tstart:), tend=tend)
    if (tend==0) exit
    if (tag%is_parsed()) call self%add_tag(tag)
    tstart = tstart + tend
  enddo
  endsubroutine parse_from_string