The problem is that the data structure you're iterating is not the same as the one you dump out at the beginning. If you called Dumper after XMLin() rather than before XMLout() then this would be clear.
The reason the data structure is different is because you haven't specified a value for the ForceArray option. This article should help you understand what's going on.
PS: the Perlmonks site is a much better place to get your questions answered.