Convert the whole tag into a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
|
logical, | intent(in), | optional | :: | linearize |
Return a "linearized" string of tags without the XML hieararchy. |
Output string containing the whole tag.
pure function stringify(self, is_indented, is_content_indented, only_start, only_content, only_end, linearize) 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. logical, intent(in), optional :: linearize !< Return a "linearized" string of tags without the XML hieararchy. logical :: linearize_ !< Linearize sentinel, local var. 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. linearize_ = .false. ; if (present(linearize)) linearize_ = linearize if (linearize_) then stringed = '' stringed = stringed//'name: "'//self%tag_name //'"'//new_line('a') if (self%attributes_number>0) stringed = stringed//'attributes: "'//self%attributes() //'"'//new_line('a') stringed = stringed//'char pos indexes:"'//trim(str(self%pos)) //'"'//new_line('a') stringed = stringed//'content: "'//self%tag_content //'"'//new_line('a') stringed = stringed//'indent: "'//trim(str(self%indent)) //'"'//new_line('a') stringed = stringed//'is self closing: "'//trim(str(self%is_self_closing))//'"'//new_line('a') stringed = stringed//'level: "'//trim(str(self%level)) //'"'//new_line('a') stringed = stringed//'id: "'//trim(str(self%id)) //'"'//new_line('a') stringed = stringed//'parent id: "'//trim(str(self%parent_id)) //'"'//new_line('a') stringed = stringed//'children number: "'//trim(str(self%children_number))//'"'//new_line('a') if (allocated(self%child_id)) stringed = stringed//'children ids: "'//trim(str(self%child_id)) //'"'//new_line('a') else 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 endif endfunction stringify