If you look closely at the surrounding code, you will see that
it is an "if all else fails" condition. Your XML-String is not
supposed to go to this code. Rather it should go to line 452 where
it only arrives if it is tied to IO::Scalar (I think). I had the
same problem before. In my case it was the calling code, which
"untied" the string after the first toplevel node was processed.
Effectively you could only process XML-Files which had a surrounding
structure, which is of course absurd for
logfiles.