Move the ScanTree method from PatternExecutor to the DOMTree class. DOMTree contains all the nodes, so this method best fits in this class.