June 17th, 2002, 04:53 PM
How to do "Order by... desc" with XML?
I'm wanting to totally change over from using MySQL to using XML, since I believe that it's the way of the future. And it's a lot of fun trying new things
But anyway, in MySQL I can select some data like in this example SQL statement:
"SELECT message FROM messageTable ORDER BY messageEditDate DESC"
See what I'm doing there? I'm selecting some messages from a database table, ordering the selection by the messageEditDate, in decending order (so the most recently messages appear at the top!).
So, I'd like to know how to do that using XML, in conjunction with *any* programming language. I'm planning to use ASP.NET and PHP4, but any other language is fine. I just want to know what the trick is!
I know the results could be put into any array, and then sorted into the right order - but not in this case. I'm talking about retrieving the data from huge XML files, which are far too large to efficiently load into memory.
I'm stumped. Does anyone else have any ideas? Has anyone else tried to do this before, and if so, how did you do it?
Last edited by jefferrs1983; June 17th, 2002 at 05:42 PM.
June 25th, 2002, 09:48 AM
Depends what you mean by huge XML files. I have a system that uses a PHP file that obtains XML based data and puts it into a multi-dimensional array. It worked damn quick on something equivalent to a 200+ record result.
The only other way I could think of would be to do some sort of bubble sort, but this would take longer to do.