r/javahelp • • Dec 05 '19

Best way to map xml to xml?

Beginner Java dev here that started working on a Spring application that receives an XML request. This XML request has to be sent to another endpoint, but in a slightly different format, so it requires me to remap some fields. What's the best way to do this?

I tried using Mapstruct, but it seems to be catered to mapping between POJO's and DTO's... not so much XML. Or am I missing some functionality? The documentation does not mention XML to XML mapping.

17 Upvotes

2 comments sorted by

3

u/karstens_rage Extreme Brewer Dec 05 '19

Saxon will allow you to perform XSLTransform'ations.

2

u/dastardly740 Dec 06 '19

Or Xalan. Unless you need XSLT 2.