in reply to How can I replace a line (tag) in an XML file?

I usually use XML::XSH2 for XML manipulation. In this case, this script would make it:
open test.xml ; set /students/student[id="002"]/gpa "B" ; save :b ;