function parse(xml) {
	// Create the return object
	const obj = {};

	let text = "";

	if (xml.nodeType === 1) {
		// do attributes
		parseAttributes(obj, xml);
	}

	// do children
	if (xml.hasChildNodes()) {
		const children = xml.childNodes;
		for (const node of children) {
			switch (node.nodeType) {
				case 1:
					normalize(obj, node);
					break;

				case 3:
					text += node.nodeValue.trim();
					break;
			}
		}
	}

	if (text) {
		obj.text = text;
	}

	return obj;
}
Parse a XML TMX object and returns the corresponding javascript object
@memberof TMXUtils
@param {Document} xml - XML TMX object
@returns {object} Javascript object