/** * This method creates a new InMemoryDocument with the {@link org.w3c.dom.Document} content and the given name * * @param document * the {@link org.w3c.dom.Document} to store * @param name * the ouput filename * @return a new instance of InMemoryDocument with the XML and the given filename */ public static DSSDocument createDssDocumentFromDomDocument(Document document, String name) { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { DomUtils.writeDocumentTo(document, baos); return new InMemoryDocument(baos.toByteArray(), name, MimeType.XML); } catch (IOException e) { throw new DSSException(e); } }