Refactored to use parseXML.