Can I sort the List returned by Node.selectNodes()?

I’ve found very interesting this example but how is possible to change the default order with XPATH’ parameter?

For example the following code parses an XML play and finds all the SPEAKER elements sorted in name order.

SAXReader reader = new SAXReader();
Document document = reader.read( new File( "xml/much_ado.xml" ) );
List speakers = document.selectNodes( "//SPEAKER", "." );

               

To resolve this problem i use a XSLT transformation <xsl:sort select ="@id" order ="descending"/>

I did’nt find any solution in w3c  XPATH’s  documentation.

Thanks

 

Jacques SAINT-PIERRE

Banque Féderale des Banques Populaires

Direction Technologies / Responsable Projets

Le Ponant de Paris

5 rue Leblanc

75511 Paris Cedex 15

Tél : 01.40.39.66.20 et GSM 06.07.78.07.54

Fax : 01.53.78.76.20

 

Reply via email to