XML parsing code with option and location objects