You should really perform these types of operations directly in the SQL. Why do you need to use an XML file? It would be easier to read the data directly into PHP from the db, and order the results e.g.
SELECT * FROM tblname WHERE criteria ORDER BY atmvalue DESC
That way the first row will be the highest, second row will be next highest etc.
or if you only want the top value then build your select statement like:
SELECT MAX(atmvalue) FROM tblname WHERE criteria
Hope this helps