#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Posts
    3
    Rep Power
    0

    How to do "Order by... desc" with XML?


    Hi all,

    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.
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Oct 2001
    Location
    New Zealand
    Posts
    1,774
    Rep Power
    24
    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.

IMN logo majestic logo threadwatch logo seochat tools logo