In that case, you could either split the XML file into multiple files (one for each letter of the alphabet) and thus effectively do all your searching once and for all; or since (depending on how much consistency there is between the format of each record - which fields they have and so on) it sounds like you're talking about a table of data, store it as a table in a database. Getting it into the database would be best done by a stream-based XML parser ([man]xml_parse[/man]), which could, I guess, be used to search the XML for what you're after in the first place, but remember you'll be reading the entire file for every query.