tests/xmlreader.cpp: factor out the xml::reader event reading and printing into a helper method