Allow nulls for write elements in MXSerializer by garydgregory · Pull Request #29 · codehaus-plexus/plexus-xml

Test:

	 public static void main(String[] args) throws ParserConfigurationException, TransformerException {
			Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
			Element root = doc.createElement("root");
			root.setTextContent(null);
			root.setAttribute("foo", null);
			doc.appendChild(root);

			DOMSource domSource = new DOMSource(doc);
			StreamResult result = new StreamResult(System.out);
	        TransformerFactory tf = TransformerFactory.newInstance();
	        Transformer transformer = tf.newTransformer();
	        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
	        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
	        transformer.transform(domSource, result);
		}

output:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root foo=""/>