protected Element createElement(String key, Object value) {
		Element elem = null;
		if (value instanceof Element) {
			elem = createElementFromElement(key, (Element) value);
		}
		else if (value instanceof Byte) {
			elem = setAttributes(key, "byte", ((Byte) value).toString());
		}
		else if (value instanceof Short) {
			elem = setAttributes(key, "short", ((Short) value).toString());
		}
		else if (value instanceof Integer) {
			elem = setAttributes(key, "int", ((Integer) value).toString());
		}
		else if (value instanceof Long) {
			elem = setAttributes(key, "long", ((Long) value).toString());
		}
		else if (value instanceof Float) {
			elem = setAttributes(key, "float", ((Float) value).toString());
		}
		else if (value instanceof Double) {
			elem = setAttributes(key, "double", ((Double) value).toString());
		}
		else if (value instanceof Boolean) {
			elem = setAttributes(key, "boolean", ((Boolean) value).toString());
		}
		else if (value instanceof String) {
			elem = new Element(STATE);
			elem.setAttribute(NAME, key);
			elem.setAttribute(TYPE, "string");
			if (XmlUtilities.hasInvalidXMLCharacters((String) value)) {
				elem.setAttribute("ENCODED_VALUE", NumericUtilities
						.convertBytesToString(((String) value).getBytes(StandardCharsets.UTF_8)));
			}
			else {
				elem.setAttribute(VALUE, (String) value);
			}
		}
		else if (value instanceof Color) {
			elem = setAttributes(key, "Color", Integer.toString(((Color) value).getRGB()));
		}
		else if (value instanceof Date) {
			elem = setAttributes(key, "Date", DATE_FORMAT.format((Date) value));
		}
		else if (value instanceof File) {
			elem = setAttributes(key, "File", ((File) value).getAbsolutePath());
		}
		else if (value instanceof KeyStroke) {
			elem = setAttributes(key, "KeyStroke", value.toString());
		}
		else if (value instanceof Font font) {
			elem = setAttributes(key, "Font", toFontString(font));
		}
		else if (value instanceof byte[]) {
			elem = new Element("BYTES");
			elem.setAttribute(NAME, key);
			elem.setAttribute(VALUE, NumericUtilities.convertBytesToString((byte[]) value));
		}
		else if (value instanceof short[]) {
			elem = setArrayAttributes(key, "short", value);
		}
		else if (value instanceof int[]) {
			elem = setArrayAttributes(key, "int", value);
		}
		else if (value instanceof long[]) {
			elem = setArrayAttributes(key, "long", value);
		}
		else if (value instanceof float[]) {
			elem = setArrayAttributes(key, "float", value);
		}
		else if (value instanceof double[]) {
			elem = setArrayAttributes(key, "double", value);
		}
		else if (value instanceof boolean[]) {
			elem = setArrayAttributes(key, "boolean", value);
		}
		else if (value instanceof String[]) {
			elem = setArrayAttributes(key, "string", value);
		}
		else if (value instanceof Enum) {
			Enum<?> e = (Enum<?>) value;
			elem = new Element("ENUM");
			elem.setAttribute(NAME, key);
			elem.setAttribute(TYPE, "enum");
			elem.setAttribute("CLASS", e.getClass().getName());
			elem.setAttribute(VALUE, e.name());
		}
		else if (value instanceof GProperties) {
			Element savedElement = ((GProperties) value).saveToXml();
			elem = new Element(GPROPERTIES_TAG);
			elem.setAttribute(NAME, key);
			elem.setAttribute(TYPE, G_PROPERTIES_TYPE);
			elem.addContent(savedElement);
		}
		else {
			elem = new Element("NULL");
			elem.setAttribute(NAME, key);
		}
		return elem;
	}
Save this object to an XML element.
@return Element XML element containing the properties
Ghidra/Framework/Generic/src/main/java/ghidra/framework/options/GProperties.java