Hello I have an XML similiar to below, which needed to be sorted using the date field.
I would like to sort the XML based on the date(say asc order), irrespective of whether the date is under Node1 or Node2. Actually in Java code I have two seperate lists, one with Node1 objects and other with Node2 obects. I can sort the list in any order sperately inside java. But I need to have the dates sorted irrespective of the nodes it is apperaing on the XML. What is the best approach to sort this way in Java?
Actaully I am using Castor for marshalling the java objects to XML. If you know this can be done with Castor, that will be great!
解决方案
I'd use XSLT, it has probs with sorting dates that you'll need to work round, simplest way if you can control it is to have sortable date format like yyyymmdd