public static byte[] xmlToByteArray(Element root) {
		ByteArrayOutputStream os = new ByteArrayOutputStream();
		Document doc = new Document(root);
		XMLOutputter xmlOut = new GenericXMLOutputter();
		try {
			xmlOut.output(doc, os);
			os.close();
			return os.toByteArray();
		}
		catch (IOException e) {
			// can't happen
		}
		return null;
	}
Converts the specified XML element into a byte array.

@param root the root element
@return the byte array translation of the given element
Ghidra/Framework/Generic/src/main/java/ghidra/util/xml/XmlUtilities.java