QXmlSimpleReader: extract method to unwind the parse stack
This code is duplicated in every parse*() function, so factor it out
into a separate helper method.
Some of the functions also do some initialization if the parse stack is
empty. I thought about adding an initialization function as a third
parameter to the helper method, but for now decided to keep the code
simple and leave such initialization untouched. That means that we migth
check the stack state twice, but I guess it's acceptable.
This patch is a pre-requisite for a rewrite from recursive to iterative
approach of XML parsing, so picking it to all branches, including ESM.
Task-number: QTBUG-149171
Pick-to: 6.12 6.12.0 6.11.3 6.8 6.5 5.15
Change-Id: I1a9c106cc3565180028a4f31b07b04353bcf78df
Reviewed-by: Marc Mutz <marc.mutz@qt.io>