#TODO: docstring

    :param xmlWriter: #TODO: docstring
    :param outputFile: #TODO: docstring
491791
def _writeMzmlChecksum(xmlWriter, outputFile):
    
    sha = hashlib.sha1(outputFile.getvalue())
    sha.update('<fileChecksum>')

    xmlChecksumElement = ETREE.Element('fileChecksum')
    xmlChecksumElement.text = sha.hexdigest()

    xmlWriter.write(xmlChecksumElement, pretty_print=True)
892855
def write_xml(xml)
      fname = "#{@appliance_name}.xml"
      File.open("#{@dir.tmp}/#{fname}", 'w'){|f| f.write(xml)}
      register_deliverable(:xml => fname)
    end
927276
public void simpleFastWrite(Writer out)
            throws IOException, XmlModelWriterException
    {
        out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
        
        if (_publicID != null && _systemID != null) {
            out.write("<!DOCTYPE ");
            out.write(_rootName);
            out.write(" PUBLIC \"");
            out.write(_publicID);
            out.write("\" \"");
            out.write(_systemID);
            out.write("\">\n");
        }
        
        writeElement(out, _doc.getDocumentElement(), 0);
    }
1266130
void writeDocument(OutputStream outStream, Document doc) {
        DOMImplementationRegistry domRegistry = null;
        try {
            domRegistry = DOMImplementationRegistry.newInstance();
        // Fortify Mod: Broaden try block to capture all potential exceptions
        // } catch (Exception e) {
        //    LOGR.warning(e.getMessage());
        // }
        DOMImplementationLS impl = (DOMImplementationLS) domRegistry
                .getDOMImplementation("LS");
        LSSerializer writer = impl.createLSSerializer();
        writer.getDomConfig().setParameter("xml-declaration", false);
        writer.getDomConfig().setParameter("format-pretty-print", true);
        LSOutput output = impl.createLSOutput();
        output.setEncoding("UTF-8");
        output.setByteStream(outStream);
        writer.write(doc, output);
        } catch (Exception e) {
            LOGR.warning(e.getMessage());
        }
    }
415672
private void writeFileArgument(String key, File file, XMLEventWriter writer)
            throws XMLStreamException, JournalException {
        try {
            putStartTag(writer, QNAME_TAG_ARGUMENT);
            putAttribute(writer, QNAME_ATTR_NAME, key);
            putAttribute(writer, QNAME_ATTR_TYPE, ARGUMENT_TYPE_STREAM);

            EncodingBase64InputStream encoder =
                    new EncodingBase64InputStream(new BufferedInputStream(new FileInputStream(file)));
            String encodedChunk;
            while (null != (encodedChunk = encoder.read(1000))) {
                putCharacters(writer, encodedChunk);
            }
            encoder.close();
            putEndTag(writer, QNAME_TAG_ARGUMENT);
        } catch (IOException e) {
            throw new JournalException("IO Exception on temp file", e);
        }
    }
889916
@Override
    public void writeXML(@WillClose XMLOutput xmlOutput) throws IOException {
        assert project != null;
        try {
            writePrologue(xmlOutput);
            if (withMessages) {
                computeBugHashes();
                getProjectStats().computeFileStats(this);
                String commonBase = null;
                for (String s : project.getSourceDirList()) {
                    if (commonBase == null) {
                        commonBase = s;
                    } else {
                        commonBase = commonBase.substring(0, commonPrefix(commonBase, s));
                    }

                }
                if (commonBase != null && commonBase.length() > 0) {
                    if (commonBase.indexOf("/./") > 0) {
                        commonBase = commonBase.substring(0, commonBase.indexOf("/."));
                    }
                    File base = new File(commonBase);
                    if (base.exists() && base.isDirectory() && base.canRead()) {
                        SourceLineAnnotation.generateRelativeSource(base, project);
                    }
                }
            }
            if (earlyStats && !minimalXML) {
                getProjectStats().writeXML(xmlOutput, withMessages);
            }

            // Write BugInstances
            for (BugInstance bugInstance : getCollection()) {
                if (!applySuppressions || !project.getSuppressionFilter().match(bugInstance)) {
                    bugInstance.writeXML(xmlOutput, this, withMessages);
                }
            }

            writeEpilogue(xmlOutput);

        } finally {
            xmlOutput.finish();
            SourceLineAnnotation.clearGenerateRelativeSource();
        }
    }
120866
public static void saveXML(Document document, File file) {
		OutputFormat format = OutputFormat.createPrettyPrint();
		XMLWriter xmlWriter = null;
		try {

			xmlWriter = new XMLWriter(new FileOutputStream(file), format);
			xmlWriter.write(document);

		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			if (xmlWriter != null) {
				try {
					xmlWriter.close();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
	}
408611
public static void serializeXMLDocument (Document doc, Writer output) throws TransformerException {
        // serialize XML document using identity transformation
        Transformer trans = TransformerFactory.newInstance().newTransformer();
        DOMSource source = new DOMSource(doc);
        StreamResult result = new StreamResult(output);
        trans.transform(source, result);
    }
753530
public void xmlWriteOn(FormattedWriter writer) throws IOException
  {
    writer.newLine();
    writer.taggedValue("referencedMsg", msgId);
    writer.newLine();
    writer.taggedValue("AOTicks", tick+","+prevTick);
    writer.newLine();
    writer.taggedValue("gatheredMEUuid", sourceMEUuid);
  }
939181
public void xmlWriteOn(FormattedWriter writer) throws IOException
   {
     writer.newLine();
     writer.taggedValue("MEUuid", messagingEngineUuid);
     writer.newLine();
     writer.taggedValue("toBeDeleted", toBeDeleted);
   }
744166
private static void serializeDocToStream(final OutputStream output, final Document doc) throws IOException {
        final OutputFormat format = OutputFormat.createPrettyPrint();
        final XMLWriter writer = new XMLWriter(output, format);
        writer.write(doc);
        writer.flush();
    }
350797
public final String rewriteXml(
        Node xmlDoc,
        String aloneTags[],
        boolean outputXmlHeader
    ) {
        try {
            StringWriter sOut = new StringWriter();
            rewriteXml(
                sOut,
                xmlDoc,
                aloneTags,
                outputXmlHeader
            );

            return sOut.toString();
        } catch (Exception e) {
            e.printStackTrace();

            return null;
        }
    }
465396
@Override
    public void writeText(PDDocument doc, Writer outputStream) throws IOException
    {
        try
        {
            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
            DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
            LSSerializer writer = impl.createLSSerializer();
            LSOutput output = impl.createLSOutput();
            writer.getDomConfig().setParameter("format-pretty-print", true);
            output.setCharacterStream(outputStream);
            createDOM(doc);
            writer.write(getDocument(), output);
        } catch (ClassCastException e) {
            throw new IOException("Error: cannot initialize the DOM serializer", e);
        } catch (ClassNotFoundException e) {
            throw new IOException("Error: cannot initialize the DOM serializer", e);
        } catch (InstantiationException e) {
            throw new IOException("Error: cannot initialize the DOM serializer", e);
        } catch (IllegalAccessException e) {
            throw new IOException("Error: cannot initialize the DOM serializer", e);
        }
    }
1141475
protected final void xmlWriteChildrenOn(FormattedWriter writer) throws IOException
    {
        super.xmlWriteChildrenOn(writer);
        if (null != _references)
        {
            _references.xmlWriteChildrenOn(writer, XML_REFERENCES);
        }
    }
286238
public static boolean writeDocumentToFile(Document doc, String localFile) {
        try {
            TransformerFactory transfact = TransformerFactory.newInstance();
            Transformer trans = transfact.newTransformer();
            trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, YES);
            trans.setOutputProperty(OutputKeys.INDENT, YES);
            trans.transform(new DOMSource(doc), new StreamResult(new File(localFile)));
            return true;
        } catch (TransformerConfigurationException ex) {
            LOG.warn(ERROR_WRITING, localFile, ex);
            return false;
        } catch (TransformerException ex) {
            LOG.warn(ERROR_WRITING, localFile, ex);
            return false;
        }
    }
1202508
public static void writeXml(Serializable serializable, OutputStream output) throws IOException {
		TransportFormat.XML.writeSerializableTo(serializable, output);
	}
1127391
public void xmlWriteOn(FormattedWriter writer) throws IOException
  {
    writer.newLine();
    writer.taggedValue("tick", _tick);
    writer.taggedValue("protocolState", _protocolState);
  }