get_attributes Subroutine

private elemental subroutine get_attributes(self, source)

Get the attributes values from source after tag_name and attributes names have been set.

Type Bound

xml_tag

Arguments

Type IntentOptional Attributes Name
class(xml_tag), intent(inout) :: self

XML tag.

character(len=*), intent(in) :: source

String containing data.


Called by

proc~~get_attributes~~CalledByGraph proc~get_attributes xml_tag%get_attributes proc~get xml_tag%get proc~get->proc~get_attributes proc~parse xml_tag%parse proc~parse->proc~get proc~search xml_tag%search proc~search->proc~parse program~foxy_test_create_tag foxy_test_create_tag program~foxy_test_create_tag->proc~parse proc~get_content xml_tag%get_content proc~get_content->proc~search proc~content xml_file%content proc~content->proc~get_content

Source Code

   elemental subroutine get_attributes(self, source)
   !< Get the attributes values from source after tag_name and attributes names have been set.
   class(xml_tag), intent(inout) :: self   !< XML tag.
   character(*),   intent(in)    :: source !< String containing data.
   integer                       :: a      !< Counter.
   integer                       :: c1     !< Counter.
   integer                       :: c2     !< Counter.

   if (index(string=source, substring='<'//self%tag_name)>0) then
      if (self%attributes_number>0) then ! parsing attributes
         do a=1, self%attributes_number
            c1 = index(string=source, substring=self%attribute(1, a)//'="') + self%attribute(1, a)%len() + 2
            if (c1>self%attribute(1, a)%len() + 2) then
               c2 = index(string=source(c1:), substring='"')
               if (c2>0) then
                  self%attribute(2, a) = source(c1:c1+c2-2)
               else
                  call self%attribute(2, a)%free
               endif
            else
               call self%attribute(2, a)%free
            endif
         enddo
      endif
   endif
   endsubroutine get_attributes