If you need to handle XML, xmlstarlet (http://xmlstar.sourceforge.net) is fantastic, and much more powerful than the standard line-oriented tools like sed and awk for this task.
Similarly jq (https://stedolan.github.io/jq/) for JSON data is great.
Similarly jq (https://stedolan.github.io/jq/) for JSON data is great.