I'm not going to say his approach is "wrong" per se, maybe creative.

But, java.awt.List is part of the (heavy weight) Java GUI package. It's not intended to be use as a general list. In fact, there is no general List class, only a List interface. While XML is a text file, it is not really a flat file, and its nested structure makes it less suited for flat list-type structures. The way I would store XML data would be to create a class that models the data. So, for example, if your XML file is storing data about people, you could create a Person class with attributes String firstName, String lastName, String phoneNumber, and Address address. You would also have and Address class having attributes String street, String city, String state, and String zip. This class structure would correspond to the following XML snippet
CODE
...
<person>
<firstName>John</firstName>
<lastName>Smith</lastName>
<phone>214-555-1212</phone>
<address>
<street>1234 main street</street>
<city>Dallas</city>
<state>TX</state>
<zip>75243</zip>
</address>
</person>
<person>
<firstName>Jane</firstName>
...
This is just one simple example of how XML can be turned into a class and vice versa. In this case, you can cave the Person class implement Comparable<Person> and in the compareTo(...) method you can have set this class's natural order as alphabetical by last name, or whatever you want. Once a class properly implements the Comparable is can be sorted by the Java Collections methods.
Now, you didn't mention the kind of data you're storing in XML files. If it's just a flat list, then using XML is overkill. In that case, just go back to a flat file.
This post has been edited by alcdotcom: 25 Mar, 2007 - 07:00 AM