Re-usable XPath engine for DOM-like trees