Changed HashMap to LinkedHashMap to preserve order of XML elements