Here :
idTmp := Pos('<trans-unit id="', xmlFile.Strings[i])+16;
if idTmp > 5 then
...
idTmp
will always be greater than 5 - you are adding 16 to it no matter what and it always returns a positive value (or zero if no match).
The simplest change here would be :
idTmp := Pos('<trans-unit id="', xmlFile.Strings[i]);
if idTmp > 0 then begin //Pos returns 0 if no match found
idTmp := idTmp + 16;
idTmp2 := PosEx('"', xmlFile.Strings[i], idTmp);
idList.Add(Copy(xmlFile.Strings[i], idTmp, idTmp2-idTmp));
end;
The change for the other two blocks would follow in a similar way.
You'll notice that I used StrUtils.PosEx here for idTmp2
- I don't know how your code compiled using Pos for the second function...
Edit
Ok, it looks like Pos was changed in XE3 to include offset overloads. If performance is your objective here (as it seems from comments) you should probably have a read of this :
http://qc.embarcadero.com/wc/qcmain.aspx?d=111103
Additionally, which I think is probably quite important, this really is a terrible way to parse XML. I highly suggest you read through some source code from projects that do this already to get a better understanding of how you should approach the problem. Some examples might be :