Prevent undefined behavior

Convert QStringRef into QString sooner because apparently reading
more XML causes the QStringRef to get invalid depending on how much
more is read. Great that this was not mentioned in docs. Even though
it's kind of obvious that the QStringRef must be invalidated when
thinking that QStringRef just references some substring of a buffer.