Efficient Algorithms for Processing XPath Queries