private static Element getSpacesElement(Language lang) {
		Element spacesElement = new Element("spaces");
		AddressFactory addrFactory = lang.getAddressFactory();
		AddressSpace defSpace = addrFactory.getDefaultAddressSpace();
		for (AddressSpace space : lang.getAddressFactory().getAllAddressSpaces()) {
			Element element;
			if (space instanceof SegmentedAddressSpace) {
				element = new Element("segmented_space");
				if (space instanceof ProtectedAddressSpace) {
					element.setAttribute("type", "protected");
				}
				else {
					element.setAttribute("type", "real");
				}
				element.setAttribute("name", space.getName());
			}
			else {
				String type;
				switch (space.getType()) {
					case AddressSpace.TYPE_CODE:
						type = "code";
						break;
					case AddressSpace.TYPE_RAM:
						type = "ram";
						break;
					case AddressSpace.TYPE_REGISTER:
						type = "register";
						break;
					default:
						continue;
				}
				element = new Element("space");
				element.setAttribute("name", space.getName());
				element.setAttribute("type", type);
				element.setAttribute("size", Integer.toString(space.getSize() / 8));
				int wordsize = space.getAddressableUnitSize();
				if (wordsize != 1) {
					element.setAttribute("wordsize", Integer.toString(wordsize));
				}
			}

			//element.setAttribute("unique", Integer.toString(space.getUnique()));

			if (space == defSpace) {
				element.setAttribute("default", "yes");
			}
			spacesElement.addContent(element);
		}
		return spacesElement;
	}
Create old-language file for the specified language.
@param lang language
@param file output file
@throws IOException if file error occurs
@throws LanguageNotFoundException if lang is unknown to DefaultLanguageService
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/OldLanguageFactory.java