Send this document as text to this output stream.
@param doc
424278
public static void convertDOMToXML(Node doc, Writer out)
    {
        try {
            // Use a Transformer for output
            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer();

            DOMSource source = new DOMSource(doc);

            StreamResult result = new StreamResult(out);
            transformer.transform(source, result);
        } catch (TransformerConfigurationException tce) {
            // Error generated by the parser
            tce.printStackTrace();
        } catch (TransformerException te) {
            // Error generated by the parser
            te.printStackTrace();
        }
    }
658793
private void addToBuffer(String document) {
        if (timerMDC == null) {
            timerMDC = MDC.get("name");
        }

        int length = document.length();
        // If this is the first document in the buffer, record its age
        bufferYoungest = new Date().getTime();
        if (docBuffer.isEmpty()) {
            bufferOldest = new Date().getTime();
            log.debug("=== New buffer starting: {}", bufferOldest);
        }
        // Add to the buffer
        docBuffer.add(document);
        bufferSize += length;
        // Check if submission is required
        checkBuffer();
    }
499672
public void writeContent(final OutputStream result) throws IOException
    {
		this.shapeNr = this.doc.getRandomInt();
		
		this.properties.put("ShapeType", new RtfShapeProperty("ShapeType", this.type));
		if(this.position.isShapeBelowText()) {
			this.properties.put("fBehindDocument", new RtfShapeProperty("fBehindDocument", true));
		}
		if(this.inTable) {
			this.properties.put("fLayoutInCell", new RtfShapeProperty("fLayoutInCell", true));
		}
		if(this.properties.containsKey("posh")) {
			this.position.setIgnoreXRelative(true);
		}
		if(this.properties.containsKey("posv")) {
			this.position.setIgnoreYRelative(true);
		}
    	
    	result.write(OPEN_GROUP);
    	result.write(DocWriter.getISOBytes("\\shp"));
    	result.write(DocWriter.getISOBytes("\\shplid"));
    	result.write(intToByteArray(this.shapeNr));
    	this.position.writeContent(result);
    	switch(this.wrapping) {
    	case SHAPE_WRAP_NONE:
    		result.write(DocWriter.getISOBytes("\\shpwr3"));
    		break;
    	case SHAPE_WRAP_TOP_BOTTOM:
    		result.write(DocWriter.getISOBytes("\\shpwr1"));
    		break;
    	case SHAPE_WRAP_BOTH:
    		result.write(DocWriter.getISOBytes("\\shpwr2"));
    		result.write(DocWriter.getISOBytes("\\shpwrk0"));
    		break;
    	case SHAPE_WRAP_LEFT:
    		result.write(DocWriter.getISOBytes("\\shpwr2"));
    		result.write(DocWriter.getISOBytes("\\shpwrk1"));
    		break;
    	case SHAPE_WRAP_RIGHT:
    		result.write(DocWriter.getISOBytes("\\shpwr2"));
    		result.write(DocWriter.getISOBytes("\\shpwrk2"));
    		break;
    	case SHAPE_WRAP_LARGEST:
    		result.write(DocWriter.getISOBytes("\\shpwr2"));
    		result.write(DocWriter.getISOBytes("\\shpwrk3"));
    		break;
    	case SHAPE_WRAP_TIGHT_BOTH:
    		result.write(DocWriter.getISOBytes("\\shpwr4"));
    		result.write(DocWriter.getISOBytes("\\shpwrk0"));
    		break;
    	case SHAPE_WRAP_TIGHT_LEFT:
    		result.write(DocWriter.getISOBytes("\\shpwr4"));
    		result.write(DocWriter.getISOBytes("\\shpwrk1"));
    		break;
    	case SHAPE_WRAP_TIGHT_RIGHT:
    		result.write(DocWriter.getISOBytes("\\shpwr4"));
    		result.write(DocWriter.getISOBytes("\\shpwrk2"));
    		break;
    	case SHAPE_WRAP_TIGHT_LARGEST:
    		result.write(DocWriter.getISOBytes("\\shpwr4"));
    		result.write(DocWriter.getISOBytes("\\shpwrk3"));
    		break;
    	case SHAPE_WRAP_THROUGH:
    		result.write(DocWriter.getISOBytes("\\shpwr5"));
    		break;
    	default:
    		result.write(DocWriter.getISOBytes("\\shpwr3"));
    	}
    	if(this.inHeader) {
    		result.write(DocWriter.getISOBytes("\\shpfhdr1"));
    	} 
    	this.doc.outputDebugLinebreak(result);
    	result.write(OPEN_GROUP);
    	result.write(DocWriter.getISOBytes("\\*\\shpinst"));
    	Iterator it = this.properties.values().iterator();
    	while(it.hasNext()) {
    		RtfShapeProperty rsp = (RtfShapeProperty) it.next();
    		rsp.setRtfDocument(this.doc);
    		rsp.writeContent(result);
    	}
    	if(!this.shapeText.equals("")) {
    		result.write(OPEN_GROUP);
    		result.write(DocWriter.getISOBytes("\\shptxt"));
    		result.write(DELIMITER);
    		result.write(DocWriter.getISOBytes(this.shapeText));
    		result.write(CLOSE_GROUP);
    	}
    	result.write(CLOSE_GROUP);
    	this.doc.outputDebugLinebreak(result);
    	result.write(CLOSE_GROUP);
		
    }
837595
private void inlineImages(Document doc) {
        Elements allImages = doc.getElementsByTag(IMG_TAG);
        for (Element img : allImages) {
            if (img.attr(DATA_INLINE_ATTR).equals("true")) {
                String src = img.attr(IMG_SRC_ATTR);
                try {
                    URL url = new URL(src);
                    URLConnection urlConnection = url.openConnection();
                    urlConnection.connect();
                    String contentType = urlConnection.getContentType();

                    urlConnection.getContent();
                    byte[] srcContent = IOUtils.toByteArray(url.openStream());
                    String base64 = new Base64().encodeToString(srcContent);

                    img.attr(IMG_SRC_ATTR, MessageFormat.format("data:{0};base64,{1}", contentType, base64));
                } catch (Exception e) {
                    LOG.log(Level.WARNING, null, e);
                }
            }
        }
    }
1042177
public static String toStr(Document doc, String charset, boolean isPretty) {
		final StringWriter writer = StrUtil.getWriter();
		try {
			write(doc, writer, charset, isPretty ? INDENT_DEFAULT : 0);
		} catch (Exception e) {
			throw new UtilException(e, "Trans xml document to string error!");
		}
		return writer.toString();
	}
997635
private void write(final Document document) throws IOException, TransformerException {
		TransformerFactory transformerFactory = TransformerFactory.newInstance();
		Transformer transformer = transformerFactory.newTransformer();
		transformer.setOutputProperty(OutputKeys.INDENT, "yes");
		transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
		transformer
				.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "http://cobertura.sourceforge.net/xml/coverage-04.dtd");
		try (BufferedWriter bufferedWriter = Files.newBufferedWriter(this.reportPath)) {
			transformer.transform(new DOMSource(document), new StreamResult(bufferedWriter));
		}
	}
688870
def send_document(self, document: str, reply: Message=None, on_success: callable=None,
                      reply_markup: botapi.ReplyMarkup=None):
        

        self.twx.send_document(peer=self, document=document, reply_to_message_id=reply, on_success=on_success,
                               reply_markup=reply_markup)
502489
public String putDocument(Document document) {
		String key = UUID.randomUUID().toString();
		documentMap.put(key, document);
		return key;
	}
917163
public void write(Model project, Document document, Writer writer, Format jdomFormat) throws java.io.IOException
   {
      updateModel(project, "project", new Counter(0), document.getRootElement());

      XMLOutputter outputter = new XMLOutputter();
      outputter.setFormat(jdomFormat);
      outputter.output(document, writer);
   }
311951
public void setRtfDocument(RtfDocument doc) {
        super.setRtfDocument(doc);
        for(int i = 0; i < this.chunks.size(); i++) {
            ((RtfBasicElement) this.chunks.get(i)).setRtfDocument(this.document);
        }
    }
293505
public void setRtfDocument(RtfDocument doc) {
        this.document = doc;
        if(headerAll != null) {
            headerAll.setRtfDocument(this.document);
        }
        if(headerFirst != null) {
            headerFirst.setRtfDocument(this.document);
        }
        if(headerLeft != null) {
            headerLeft.setRtfDocument(this.document);
        }
        if(headerRight != null) {
            headerRight.setRtfDocument(this.document);
        }
    }
514854
def write_document(self, document: BioCDocument):
        """"""
        tree = self.encoder.encode(document)
        self.__writer.send(tree)
870173
public void copyFile(DocFile fromFile) throws DocFileIOException {
        try (OutputStream output = openOutputStream()) {
            try (InputStream input = fromFile.openInputStream()) {
                byte[] bytearr = new byte[1024];
                int len;
                while ((len = read(fromFile, input, bytearr)) != -1) {
                    write(this, output, bytearr, len);
                }
            } catch (IOException e) {
                throw new DocFileIOException(fromFile, DocFileIOException.Mode.READ, e);
            }
        } catch (IOException e) {
            throw new DocFileIOException(this, DocFileIOException.Mode.WRITE, e);
        }
    }
676837
public static void writeXML(Document xmldocument, OutputStream stream) throws IOException {
		assert xmldocument != null : AssertMessages.notNullParameter(0);
		assert stream != null : AssertMessages.notNullParameter(1);
		writeNode(xmldocument, stream);
	}
1035583
public static void toFile(Document doc, String path, String charset) {
		if (StrUtil.isBlank(charset)) {
			charset = doc.getXmlEncoding();
		}
		if (StrUtil.isBlank(charset)) {
			charset = CharsetUtil.UTF_8;
		}

		BufferedWriter writer = null;
		try {
			writer = FileUtil.getWriter(path, charset, false);
			write(doc, writer, charset, INDENT_DEFAULT);
		} finally {
			IoUtil.close(writer);
		}
	}
807468
public static String getContentByDoc(Document doc) throws Exception {
        ContentExtractor ce = new ContentExtractor(doc);
        return ce.getContentElement().text();
    }
173024
public void writeXmlDocument(Document document, File file) throws IOException {
        try {
            Transformer tr = transformerFactory.newTransformer();
            tr.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
            tr.setOutputProperty(OutputKeys.INDENT, "yes");
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            tr.transform(new DOMSource(document), new StreamResult(fileOutputStream));
            fileOutputStream.close();
        } catch (Exception e) {
            throw new IOException(e.getMessage(), e);
        }
    }