How to obtain XML export of applied MDM profiles

How might I obtain an XML export of applied MDM profiles from an individual macOS machine? I currently troubleshoot related customer problems by requesting an XML export from the MDM console but I would like to get it directly from the target Mac. This way I can confirm that a Mac does not in fact have the required profile in place and it is either not assigned correctly in the management tool or there is some other MDM communication problem.

Replies

A customer pointed me in direction of this command:

sudo profiles show -all -verbose -output stdout-xml > ~/Desktop/profiles_xml_output.txt

This produces something that looks like what I want... but how do I parse the output into XML that will open in something like iMazing Profile Editor for quick and easy review?