Cleanup and optimizations in avm2/xml.js