An XML parsing module such as the one mentionned in the posts above is probably the right way to go. However, for such a simple change (and assuming that's really all you need to do), you may try to do it manually. The easiest might be to
reverse the lines (you may have to store them first in an array if it is not already the case), make the change on the first occurrence of what you are looking for, and then
reverse the lines again.
Update: Fixed a typo in the parenthesed sentence about having to store the data in an array.