Hi. For XML the document order is important, so don't wonder why you get the data this way. If you want it different, there are many ways:
- Create your document ordered. XML preserves this order, and you can retrieve the data ordered again. This does not work if you can think of several ways of ordering. - Use XSLT to change the ordering. There are quite simple statements that can do what you need. - Write your own DOM sorter. I cannot remember there is one in libraries like Xalan or Xerces you can easily use. Maybe (and hopefully) I'm wrong? Hiran > -----Urspr�ngliche Nachricht----- > Von: Java Xerces Rule [mailto:[EMAIL PROTECTED] > Gesendet: Mittwoch, 21. November 2001 17:31 > An: [EMAIL PROTECTED] > Betreff: How to order alphabetically > > > Hi all! > > I'm parsing an XML document: > ------//----------- > <table> > <pupil> > <name></name> > <surname></surname> > </pupil> > ... > </table> > ----------//--------- > > I would like to display Pupils' data, but ordering them > alphabetically by the surname. > > I'm trying it by using: > -----------//---------------- > NodeList PupilList = root.getElementsByTagName("pupil"); > int NumberPupils = PupilList.getLength(); > for (int i=0; i<NumberPupils; i++) { > Node PupilAlone = PupilList.item(i); > traversePupil(PupilAlone); > ... > ----------//-------------- > > But they are ordered in the same way they are in the XML > document. > > Any suggestion? Thank you very much. > ______________________________________________________________ > _________ > Gana un antivirus abriendo tu cuenta de correo gratis en HispaVista. > http://www.hispavista.com/altacorreo/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
