def attribute(string)

      attribute_name = ""
      attribute_value = ""

      length = string.length
      position = 0

      return [nil, nil] if length == 0 

      while position < (length)

        # If character matches 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x2F (ASCII /) then advance position
        if string[position] =~ /[\u{09}\u{0A}\u{0C}\u{0D}\u{20}\u{2f}]/
          
          position += 1
        
        elsif string[position] == '>'

          attribute_name = nil
          break

        else

          while position < length
          
            if string[position] == '=' && attribute_name != ''

              attribute_value, position_increment = attribute_value(string[position + 1, length])

              position += position_increment + 1

              break

            elsif string[position] =~ /[\>\/]/
              
              break
            
            elsif string[position] =~ /[A-Z]/

              attribute_name += string[position].downcase
              position += 1

            else
              attribute_name += string[position]
              position += 1
            end

          end

          break

        end

      end

      if attribute_name
        [{attribute_name: attribute_name, attribute_value: attribute_value}, position]
      else
        [nil, position]
      end

    end
def attribute(string)

      attribute_name = ""
      attribute_value = ""

      length = string.length
      position = 0

      return [nil, nil] if length == 0 

      while position < (length)

        # If character matches 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x2F (ASCII /) then advance position
        if string[position] =~ /[\u{09}\u{0A}\u{0C}\u{0D}\u{20}\u{2f}]/
          
          position += 1
        
        elsif string[position] == '>'

          attribute_name = nil
          break

        else

          while position < length
          
            if string[position] == '=' && attribute_name != ''

              attribute_value, position_increment = attribute_value(string[position + 1, length])

              position += position_increment + 1

              break

            elsif string[position] =~ /[\>\/]/
              
              break
            
            elsif string[position] =~ /[A-Z]/

              attribute_name += string[position].downcase
              position += 1

            else
              attribute_name += string[position]
              position += 1
            end

          end

          break

        end

      end

      if attribute_name
        [{attribute_name: attribute_name, attribute_value: attribute_value}, position]
      else
        [nil, position]
      end

    end
Given a string, returns the first attribute in the sting (as a hash), and
 the position of the next character in the string