code: public static byte[] serialize(Node inputNode) throws Exception
  	{
  		// Initialize sources and targets
  		ByteArrayOutputStream serializerOutput = new ByteArrayOutputStream();
  		Source sourceObject = new DOMSource(inputNode); 
  		Result targetObject = new StreamResult(serializerOutput);
  		
  		// Create XML Transformer
  		TransformerFactory serializerFactory = TransformerFactory.newInstance();
  		Transformer serializer = serializerFactory.newTransformer();
  
  		// Set output properties
  		serializer.setOutputProperty(OutputKeys.INDENT, "yes");
  		serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
  		
  		// Run serialization transformation
  		serializer.transform(sourceObject, targetObject);
  		
  		// Return output as a byte array
  		return serializerOutput.toByteArray();
  	}
docs: Simple method to serialize a DOM-bound XML object to a byte array (string)
  
  @param inputNode	DOM Node to serialize
  @return Byte array of XML in ASCII form
  @throws Exception