Eliminate repeated virtual calls

This should have been part of https://github.com/leethomason/tinyxml2/pull/202 but I somehow missed this bit.