Write structured metadata to XML