If you do this in perl, you can create an array where each element in the array is a hash. (An array of hashes)
For the first RecSubacc, you'll have the following hash variables:
SubaccId 1
RecAccTotal 0
RedAccType Perm
As the file is read, if there are additional fields that appear between <RecSubacc> and </recSubacc>, it will simply create another hash.
You would use only the keys that you require - this would allow you to reuse those other keys at a later date, if your requirements change, without re-writing the entire script.
Working with XML files -
using all these tools like awk, shell scripting, sed everything would work
But IMHO
they are not maintainable,
quite difficult if you had to do some modification (just extend XPath or append something to the root element for example ),
will take more time for modification and testing.
In short, its not supported.
Instead there are wonderful perl modules available from CPAN.
Though, the initial time spent on learning and figuring out is more, its worth spending the time.
But for quick win cases, 1 time runs - all these awk/sed/shell scripting should be fine.
When the scripts that work on XML files need to be productionized or need to address a big set of file base, then they are not scalable way of doing them.