I have an issue with generating a XML file from another XML file. My use case is this:
I have a XML file with the following format:
<tag1> <tag2>value2</tag2> <tag3>value3_1, value3_2, value3_3</tag3> <tag4> <tag4_1>value4_1</tag4_1> <tag4_2>value4_2</tag4_2> </tag4> </tag1>
Yeah, I know it's pretty messy but that's the way I got it.
- I also have an XSD schema which I use to generate corresponding Java classes using JAXB (this works OK).
What I need now is a way to create another XML file from the original one, having this format:
<element name="tag1.tag2">
<value>value2</value>
</element>
<element name="tag1.tag3">
<value>value3_1, value3_2, value3_3</value>
</element>
<element name="tag1.tag4.tag4_1">
<value>value4_1</value>
</element>
<element name="tag1.tag4.tag4_2">
<value>value4_2</value>
</element>
Do you have any suggestions regarding what framework/libraries I should use to achieve this without doing my own parsing/creating mechanism?
I was thinking of using XSLT but I don't have any experience with it...
Thanks!