I need to search through a high number of XML documents for single terms (words from dictionary) that appear inside XML tags (at any level) and count them up to provide a frequency table for each term. I am using PHP5 and I'm going to run this on a local machine so time and performance hit isn't an issue - it can take a few days if required.