Return tag content of self (or its nested tags) if named name.
Note
If there is no value, the content string is returned deallocated.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_tag), | intent(in) | :: | self |
XML tag. |
||
character(len=*), | intent(in) | :: | name |
Searched tag name. |
||
character(len=:), | intent(out), | allocatable | :: | content |
Tag content. |
pure subroutine get_content(self, name, content) !< Return tag content of self (or its nested tags) if named *name*. !< !< @note If there is no value, the *content* string is returned deallocated. class(xml_tag), intent(in) :: self !< XML tag. character(*), intent(in) :: name !< Searched tag name. character(len=:), allocatable, intent(out) :: content !< Tag content. type(xml_tag) :: tag !< Dummy XML tag. if (allocated(content)) deallocate(content) if (self%tag_name%is_allocated()) then if (self%tag_name==name) then if (self%tag_content%is_allocated()) content = self%tag_content%chars() else if (self%tag_content%is_allocated()) then call tag%search(tag_name=name, source=self%tag_content%chars()) if (tag%tag_content%is_allocated()) content = tag%tag_content%chars() endif endif endif endsubroutine get_content