I had the need to get all iPhone messages into an XML file.
Online I found that the messages get dumped into an SQLite3 DB when doing a local backup with iTunes.
https://mikebeach.org/2012/11/05/how-to-read-and-export-iphone-sms-text-messages-on-windows/
Since I already had a lot of SMS exported to an XML with Android’s ‘SMS Backup and Restore‘, I wanted the iPhone messages in the same format. Additionally Excel can import XML Tables and format them very nicely!
So I put together a PHP file, that takes the SQLite DB from the iTunes Backup and exports the XML file as I needed it: