I am going to be working with PHP and XML for this project. This project requires that once the PHP prototype is done at any time any other languiage could be used to create a drop in replacement.

As such I need an elegant way to use XML on a last in first out basis. However with SimpleXML the PHP lib I plan to use last in is last out - ie the last added node at any given level is added at the end.

This is no good for me because I need the newest nodes by date.

Now if I knew of a good way to grab the last x nodes even when the file was very large I might not have a problem.

What worries me is if nodes are entered out of sequence and the file must be sorted to retain date order integrity. I don't fancy doing a XML2Array, Array Sort, Array2XML on large files.

http://scripts.ringsworld.com/develo...array.php.html

So what I need is to know what tools I have at my disposal. If XQuery might help me and what else you can suggest.

I'd very much like to stay away from MySQL for a number of reasons not least of which I don't need it aside from fast sorting of data by date.

I found some paper abstracts that talk about doing this :

Dynamic labeling schemes for ordered XML based on type information, 2006
http://portal.acm.org/citation.cfm?id=1151736.1151743

Sketch-Based Summarization of Ordered XML Streams
http://whitepapers.techrepublic.com....x?docid=889013

so I know I'm not utterly mad but I'm lost as to where I should take my investigations next.

I do have an experts-exchange.com ticket open on the subject but nothing solid has come up yet in answer to my need for sorted XML.

http://www.experts-exchange.com/Web_..._24275453.html

That said the leading suggestion seems to be SQL which is relational when I really need the nested nature of XML plus date ordering.

I really need your input.

Thanks.