DOMUtils { public static byte[] documentToBytes(Document xmlDocument) { try { return documentToXml(xmlDocument).getBytes(DEFAULT_ENCODING); } catch (final UnsupportedEncodingException e) { throw new DOMUtilsException(e); } }  static Document bytesToDocument(byte[] bytes); static byte[] documentToBytes(Document xmlDocument); static String documentToXml(Document xmlDocument); static Optional<Node> getNode(Document xmlDocument,
			String xPathExpr, String... arguments); static Optional<NodeList> getNodeList(Document xmlDocument,
			String xPathExpr, String... arguments); static Document xmlToDocument(String xmlString); static final String DEFAULT_ENCODING; }
@Test public void testDocumentToBytes() { final byte[] b1 = DOMUtils.documentToBytes(DOCUMENT1); final byte[] b2 = DOMUtils.documentToBytes(DOCUMENT2); assertTrue(b1.length > 0); assertTrue(b2.length > 0); }