void saveToXml(Element xml) {

		Set<ExtensionDetails> installedExtensions = ExtensionUtils.getActiveInstalledExtensions();
		Element extensionsParent = new Element(EXTENSIONS_XML_NAME);
		for (ExtensionDetails ext : installedExtensions) {
			Element child = new Element(EXTENSION_ELEMENT_NAME);
			String name = ext.getName();
			if (XmlUtilities.hasInvalidXMLCharacters(name)) {
				child.setAttribute(EXTENSION_ATTRIBUTE_NAME_ENCODED, NumericUtilities
						.convertBytesToString(name.getBytes(StandardCharsets.UTF_8)));
			}
			else {
				child.setAttribute(EXTENSION_ATTRIBUTE_NAME, name);
			}

			extensionsParent.addContent(child);
		}

		xml.addContent(extensionsParent);
	}
A class to manage saving and restoring of known extension used by this tool.
Ghidra/Framework/Project/src/main/java/ghidra/framework/project/tool/ExtensionManager.java