save xml object so that elements are in sorted order in saved xml file
- by scot
Hi ,
I am saving a xml document object and it is saved in a xml file as shown below .
<author name="tom" book="Fun-II"/>
<author name="jack" book="Live-I"/>
<author name="pete" book="Code-I"/>
<author name="jack" book="Live-II"/>
<author name="pete" book="Code-II"/>
<author name="tom" book="Fun-I"/>
instead i want to sort the content in document object so that when i persist the object it is saved by grouping authors then book name as below:
<author name="jack" book="Live-I"/>
<author name="jack" book="Live-II"/>
<author name="pete" book="Code-I"/>
<author name="pete" book="Code-II"/>
<author name="tom" book="Fun-I"/>
<author name="tom" book="Fun-II"/>
I use apache xml beans..any ideas on how to achieve this?
thanks.