[jdom-interest] Sorting Question

kevin.schmidt at convergys.com kevin.schmidt at convergys.com
Mon Nov 26 06:21:55 PST 2001


I would like to have my XML file sorted in alphanumeric order by a given
attribute.
I would like to sort Artists and Albums by their name attribute, so, for
example,

<Artist name="Metallic">
     <Album name="Master of Puppets"/>
     <Album name="Load"/>
</Artist>
<Artist name="Aerosmith">
     <Album name="Toys in the Attic"/>
     <Album name="Draw the Line"/>
</Artist>

would become:

<Artist name="Aerosmith">
     <Album name="Draw the Line"/>
     <Album name="Toys in the Attic"/>
</Artist>
<Artist name="Metallic">
     <Album name="Load"/>
     <Album name="Master of Puppets"/>
</Artist>

I was thinking of using the Comparable interface for the Element class, but
it seems like a lot of work and am wondering if there is an easier way.
     -Kevin Schmidt
     Senior Web Developer
     Cincinnati, OH


--

NOTICE:  The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential.  If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected.





More information about the jdom-interest mailing list