Parse the tag attributes names contained into a string.
Valid syntax is:
+ att1="att1 val" att2="att2 val"...
Note
Inside the attributes value the symbols <
and >
are not allowed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(xml_tag), | intent(inout) | :: | self |
XML tag. |
||
character(len=*), | intent(in) | :: | source |
String containing the input. |
elemental subroutine parse_attributes_names(self, source) !< Parse the tag attributes names contained into a string. !< !< Valid syntax is: !< + `att1="att1 val" att2="att2 val"...` !< @note Inside the attributes value the symbols `<` and `>` are not allowed. class(xml_tag), intent(inout) :: self !< XML tag. character(*), intent(in) :: source !< String containing the input. character(len=:), allocatable :: att !< Dummy string for parsing file. integer(I4P) :: c !< Counter. integer(I4P) :: s !< Counter. integer(I4P) :: a !< Counter. integer(I4P) :: Na !< Counter. Na = 0 c = 1 att_count: do while(c<=len(source)) if (source(c:c)=='=') Na = Na + 1 c = c + 1 enddo att_count if (Na>0) then call self%alloc_attributes(Na=Na) c = index(string=source, substring=' ') att = source(c:) c = 1 a = 1 att_search: do while(c<=len(att)) if (att(c:c)=='=') then s = max(0, index(string=att, substring=' ')) self%attribute(1, a) = trim(adjustl(att(s+1:c-1))) att = att(c+1:) c = 1 a = a + 1 endif c = c + 1 enddo att_search endif endsubroutine parse_attributes_names