class DomPoxMessage implements PoxMessage {

	@Override
	public void writeTo(OutputStream outputStream) throws IOException {
		try {
			if (outputStream instanceof TransportOutputStream) {
				TransportOutputStream transportOutputStream = (TransportOutputStream) outputStream;
				transportOutputStream.addHeader(TransportConstants.HEADER_CONTENT_TYPE, contentType);
			}
			transformer.transform(getPayloadSource(), new StreamResult(outputStream));
		} catch (TransformerException ex) {
			throw new DomPoxMessageException("Could write document: " + ex.getMessage(), ex);
		}
	}

	public  DomPoxMessage(Document document, Transformer transformer, String contentType);

}