How do we sort xml file and have a new sorted xml file without using xslt?

Hi,Can anyone please tell me how can I sort an xml file and have another sorted xml file as some xml string without using xslt and using some java APIs?
[166 byte] By [mknarulaa] at [2007-10-3 4:02:34]
# 1
Use a DocumentBuilder and parse the XML file into a DOM object. Then write Java code to rearrange the elements in that DOM in whatever way constitutes "sorting" for you. Write out the modified DOM in the usual way with a Transformer.
DrClapa at 2007-7-14 22:01:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
I'm also looking for something similar.Pl if any one has an example pl post it
naveen_17a at 2007-7-14 22:01:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...