I need to replace a tag in an XML file that resembles the following:
How would I go about finding the second instance of John (whose id is '002') and replace his GPA of 'C' with a 'B'? Keep in mind that searching for a 'C' within the entire file and replacing it with the 'B' might not be optimal because many students might have a GPA of 'C'. Since the id tag is unique for each student, is there a way to search for that unique tag, then replace the following line (in this case it would be the gpa tag) with a new line containing the 'B' GPA?
Any thoughts on this would be greatly appreciated. Thanks in advance!