XML-reader with a functional approach