This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Author and all-around good cowpoke
Joined: Mar 22, 2000
IF I understand you correctly, you dont really want to sort the XML nodes, you want to extract a list of data from the nodes and sort that by some criteria before output in JSON format.
NOW: Just look at the way I formulated the problem.
1. extract data from XML nodes to some intermediate form that can be sorted - how about a custom object?
2. sort the resulting list - how about a custom comparator that knows the order you want?
3. output to JSON - how about a method in the custom class that writes JSON to represent the object?