Applescript : text delimitation in a loop I'm trying to get values from a log file of all the occurrence of a value 
Recorded on the following key :

&gt; &lt;key&gt;MyTime&lt;/key&gt;         &lt;string&gt;2019-03-29T08:48:18+0000&lt;/string&gt;
&gt;       &lt;key&gt;serviceToken&lt;/key&gt;


I can get the first occurrence of the value I want with the following code, but how can I search for more occurrence and add in secondary variable ?

##Getting the file name
set ShortDate to short date string of (current date)
set [dayN, MonthN, YearN] to the words of ShortDate
set myUSDate to YearN &amp; MonthN &amp; dayN as string
set myFileName to "TIME" &amp; myUSDate &amp; ".log"

set p to "/Users/kevin/Library/Logs/MyAPP/" &amp; myFileName
set plistfile_path to POSIX file p

property leftEdge1 : "&lt;key&gt;myValueTime&lt;/key&gt;"
property rightEdge1 : "&lt;key&gt;serviceToken&lt;/key&gt;"
set myNewCaseNote to ""
set newFile to (plistfile_path as text)
set theSource to read file newFile as text
set theText to Unicode text
try
    set saveTID to text item delimiters
    set text item delimiters to leftEdge1
    set classValue to text item 2 of theSource
    set text item delimiters to rightEdge1
    set myCaseNote to text item 1 of classValue
    set text item delimiters to saveTID
    myCaseNote
end try


But how can I get other occurrence of this time/data ? And not only the first one
An XML file can’t have identical keys at the same level, so I’m going to guess that it is just a plain text file with those entries.
Text item delimiters can be used for everything, but it would tend to add a bit more code, since you would need to get a list of items using the first delimiters, then use additional delimiters on those items, and so on.  In this case, you can use them to just break the text apart at the desired key, then get the text from between the first set of tags by getting their offsets, for example:

property keyValue : "&lt;key&gt;myValueTime&lt;/key&gt;"
property startTag : "&lt;string&gt;"
property stopTag : "&lt;/string&gt;"

set theSource to "&lt;key&gt;myValueTime&lt;/key&gt;        &lt;string&gt;2019-03-28T08:48:18+0000&lt;/string&gt;
&lt;key&gt;serviceToken&lt;/key&gt;
&lt;key&gt;myValueTime&lt;/key&gt;
  &lt;string&gt;2019-03-29T09:48:18+0000&lt;/string&gt;
&lt;key&gt;serviceToken&lt;/key&gt;
  &lt;string&gt;whatever&lt;/string&gt;"

set saveTID to text item delimiters
set text item delimiters to keyValue
set classValues to text items of theSource
set text item delimiters to saveTID

set myCaseNotes to {}
repeat with anItem in classValues
  set here to (offset of startTag in anItem)
  set there to (offset of stopTag in anItem)
  if here is not 0 and there is not 0 then
    set the end of myCaseNotes to text (here + (count startTag)) thru (there - 1) of anItem
  end if
end repeat

return myCaseNotes