public class XPathExpression { DOM_Document XML_DOM; Array of Strings XPathLocationStepStringsArray; Array of XPathLocationSteps XPathLocationStepsArray; Array of XPathResults ResultNodeSet; //constructor XPathExpression (string XMLFile, string XPathExpression) { XML_DOM = XMLFile loaded into a DOM; FunctionName = If there is any XPath function in the begining of the query, store the function name here; Strip the function name from the expression. XPathLocationStepStringsArray = Tokenize XPath expression into smaller strings, where each string is a location step. Also unabbreviate any XPath abbreviations found; Integer locationStepCount = Number of location step strings in XPathLocationStepStringsArray; String IndividualXPathLocationStepString; XPathLocationStep IndividualXPathLocationStep; ResultNodeSet = XML_DOM loaded into an array of XPathResults. Repeat locationStepCount times from i = 0 to locationStepCount-1: { IndividualXPathLocationStepString = XPathLocationStepStringsArray[i]; IndividualXPathLocationStep = a new object of XPathLocationStep( IndividualXPathLocationStepString, XML_DOM ); ResultNodeSet = IndividualXPathLocationStep.getResult( ResultNodeSet); } Apply the XPath function on the resulting node-set }//constructor //constructor XPathExpression (DOM_Document XML_DOM, string XPathExpression) { Same as the first constructor, except that it takes the XML file as a DOM object instead of a string. }//constructor public Array of XPathResults getResult() { return ResultNodeSet; }//getResult }//class