Started tidy-up of code in xml2json.py.