The valgrind docs show that valgrind accepts a --xml=yes
tag to output messages as XML. The format of the XML is specified in the docs/internals/xml-output-protocol4.txt
inside the source code repository.
With that, you can use any XML parser and do whatever you want with the data.