You could create a export mapping for a webservice of your entity. If you use the ' Export to XML' option in a microflow it would create a string XML of the entity defined by your export mapping.
Maybe I'm misunderstanding your use case, but:
you can simply do an export with mapping (store as string). The mapping can be based on a Message Definition from your entity.