parse Subroutine

private subroutine parse(self, string, filename)

Type Bound

xml_file

Arguments

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

Calls

proc~~parse~2~~CallsGraph proc~parse~2 xml_file%parse proc~load_file_as_stream load_file_as_stream proc~parse~2->proc~load_file_as_stream proc~parse_from_string xml_file%parse_from_string proc~parse~2->proc~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~2~~CalledByGraph proc~parse~2 xml_file%parse 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(self, string, filename)
  !< Parse xml data from string or file.
  !<
  !< @note Self data are free before trying to parse new xml data: all previously parsed data are lost.
  class(xml_file),        intent(inout) :: self     !< XML file.
  character(*), optional, intent(in)    :: string   !< String containing xml data.
  character(*), optional, intent(in)    :: filename !< File name containing xml data.
  character(len=:), allocatable         :: source   !< String containing xml data.

  call self%free
  if (present(string)) then
    call self%parse_from_string(source_string=string)
  elseif (present(filename)) then
    source = load_file_as_stream(filename=filename, fast_read=.true.)
    call self%parse_from_string(source_string=source)
  endif
  endsubroutine parse