What are the different ways to transform XML using Java?
I'm studying how to convert XML from one format to another in a java project
What are the alternatives and what are their advantages and disadvantages?
Alternatives I have found so far:
>XSLT / XQuery > bind XML in both formats to Java and map using java > groovy
Solution
If you are converting XML to XML, you can only do extra work for yourself through non - XML representations, such as Java objects Using a high-level declarative language is a viable approach, which means XSLT or XQuery
When choosing between XSLT and XQuery, my usual suggestion is that XSLT is optimized for transformation and XQuery is optimized for query "Transformation" refers to tasks where most inputs appear in the output, but in different forms "Query" refers to extracting blocks of information from a large amount of data
Of course, all these technologies have a learning curve. If you have a small one-time job to do, this may be an effective factor in choosing tools But for projects that execute XML and Java, the best advice is to use Java as little as possible Treating it as a "java project" can be a bad starting point