Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_tag), | intent(in) | :: | self | |||
logical, | intent(in), | optional | :: | is_indented | ||
logical, | intent(in), | optional | :: | is_content_indented | ||
logical, | intent(in), | optional | :: | only_start | ||
logical, | intent(in), | optional | :: | only_content | ||
logical, | intent(in), | optional | :: | only_end |
pure function stringify(self, is_indented, is_content_indented, only_start, only_content, only_end) result(stringed) !< Convert the whole tag into a string. class(xml_tag), intent(in) :: self !< XML tag. logical, intent(in), optional :: is_indented !< Activate content indentation. logical, intent(in), optional :: is_content_indented !< Activate content indentation. logical, intent(in), optional :: only_start !< Write only start tag. logical, intent(in), optional :: only_content !< Write only content. logical, intent(in), optional :: only_end !< Write only end tag. character(len=:), allocatable :: stringed !< Output string containing the whole tag. logical :: is_content_indented_ !< Activate content indentation. logical :: only_start_ !< Write only start tag. logical :: only_content_ !< Write only content. logical :: only_end_ !< Write only end tag. is_content_indented_ = .false. ; if (present(is_content_indented)) is_content_indented_ = is_content_indented only_start_ = .false. ; if (present(only_start)) only_start_ = only_start only_content_ = .false. ; if (present(only_content)) only_content_ = only_content only_end_ = .false. ; if (present(only_end)) only_end_ = only_end if (only_start_) then stringed = self%start_tag(is_indented=is_indented) elseif (only_content_) then if (self%tag_content%is_allocated()) then if (is_content_indented_) then stringed = repeat(' ', self%indent+2)//self%tag_content else stringed = self%tag_content%chars() endif endif elseif (only_end_) then stringed = self%end_tag(is_indented=is_indented) else stringed = '' if (self%tag_name%is_allocated()) then if (self%is_self_closing) then stringed = self%self_closing_tag(is_indented=is_indented) else stringed = self%start_tag(is_indented=is_indented) if (self%tag_content%is_allocated()) then if (is_content_indented_) then stringed = stringed//new_line('a')//repeat(' ', self%indent+2)//& self%tag_content//new_line('a')//repeat(' ', self%indent) else stringed = stringed//self%tag_content endif endif stringed = stringed//self%end_tag() endif endif endif endfunction stringify