/*
(non-Javadoc)

@see com.ibm.ws.sib.msgstore.AbstractItem#xmlWriteOn(com.ibm.ws.sib.msgstore.FormattedWriter)
965610
@Override
    public void xmlWriteOn(FormattedWriter writer) throws IOException
    {
        super.xmlWriteOn(writer);
        writer.newLine();
        writer.taggedValue("toBeDeleted", _toBeDeleted);
        writer.newLine();
        writer.taggedValue("toBeIgnored", _toBeIgnored);
    }
1239014
@Override
    public void xmlWriteOn(FormattedWriter writer) throws IOException
    {
        if (consumerDispatcher != null)
        {
            writer.newLine();
            writer.taggedValue("consumerDispatcher", consumerDispatcher.toString());
        }
    }
228047
@Override
    public void writeXML(@WillClose Writer out) throws IOException {
        assert project != null;
        bugsPopulated();
        XMLOutput xmlOutput;
        // if (project == null) throw new NullPointerException("No project");


        xmlOutput = new OutputStreamXMLOutput(out);

        writeXML(xmlOutput);
    }
390415
public void xmlWriteOn(FormattedWriter writer) throws IOException 
    {
        writer.newLine();
        writer.startTag(XML_ITEM_MAP);
        writer.indent();
        for (int i = 0; i < _subMaps.length; i++)
        {
            Iterator iterator = _subMaps[i].values().iterator();
            while (iterator.hasNext())
            {
                writer.newLine();
                AbstractItemLink ail = (AbstractItemLink) iterator.next();
                ail.xmlShortWriteOn(writer);
            }
        }
        writer.outdent();
        writer.newLine();
        writer.endTag(XML_ITEM_MAP);
    }
519045
public final void rewriteXml(
        Writer out,
        String xmlFile,
        String aloneTags[]
    ) {
        rewriteXml(
            out,
            xmlFile,
            aloneTags,
            false
        );
    }
1220420
public void write(Writer out)
            throws XmlModelWriterException, IOException
    {
        try
        {
            DOMSource domSource = new DOMSource(_doc);
            StreamResult streamResult = new StreamResult(out);
            TransformerFactory tf = TransformerFactory.newInstance();
            tf.setAttribute("indent-number", new Integer(INDENT_LEN));
            Transformer serializer = tf.newTransformer();
            if (_publicID != null) {
                serializer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, _publicID);
            }
            if (_systemID != null) {
                serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, _systemID);
            }
            serializer.setOutputProperty(OutputKeys.INDENT, "yes");
            serializer.transform(domSource, streamResult);
        }
        catch (TransformerException e)
        {
            throw new XmlModelWriterException(e);
        }
    }
416677
private final void _xmlWriteRawOn(FormattedWriter writer, boolean callBackToItem) throws IOException
    {
        new RawDataDumper(_persistentMessageStore, writer, callBackToItem).dump();
    }
49476
public void xmlWriteOn(FormattedWriter writer) throws IOException {
        String name = "link";
        writer.write("<");
        writer.write(name);
        xmlWriteAttributesOn(writer);
        writer.write(" />");
    }
1194161
private XMLEventWriter createXmlEventWriter(FileWriter fileWriter)
            throws FactoryConfigurationError, XMLStreamException {
        XMLOutputFactory factory = XMLOutputFactory.newInstance();
        return new IndentingXMLEventWriter(factory
                .createXMLEventWriter(fileWriter));
    }
632093
public void write(String xmlFilename) throws CmsXmlException {

        // try to get it from the cache
        Document document = m_cache.get(xmlFilename);

        if (document != null) {
            try {
                CmsXmlUtils.validateXmlStructure(document, CmsEncoder.ENCODING_UTF_8, new CmsXmlEntityResolver(null));
                OutputStream out = null;
                out = new FileOutputStream(getFile(xmlFilename));
                CmsXmlUtils.marshal(document, out, CmsEncoder.ENCODING_UTF_8);
            } catch (FileNotFoundException e) {
                throw new CmsXmlException(new CmsMessageContainer(null, e.toString()));
            } catch (CmsXmlException e) {
                // write invalid config files to the file system with a prefix of "invalid-" so they can be inspected for errors
                try {
                    OutputStream invalidOut = new FileOutputStream(getFile("invalid-" + xmlFilename));
                    CmsXmlUtils.marshal(document, invalidOut, CmsEncoder.ENCODING_UTF_8);
                } catch (IOException e2) {
                    // ignore

                }
                throw 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);
	}
478250
public function writeXML( \XMLWriter $w, string $elementName = 'ImageSizeReducers' )
   {
      
      if ( ! empty( $elementName ) )
      {
         $w->startElement( $elementName );
      }
      
      foreach ( $this as $reducer )
      {
         if ( \is_null( $reducer ) || ! ( $reducer instanceof ImageSizeReducer ) )
         {
            continue;
         }
         $reducer->writeXML( $w );
      }
      
      if ( ! empty( $elementName ) )
      {
         $w->endElement();
      }
      
   }
783757
public void writeXml(OutputStream out) throws IOException {
        Properties properties = getProps();
        try {
            Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
            Element conf = doc.createElement("configuration");
            doc.appendChild(conf);
            conf.appendChild(doc.createTextNode("\n"));
            for (Enumeration e = properties.keys(); e.hasMoreElements();) {
                String name = (String) e.nextElement();
                Object object = properties.get(name);
                String value;
                if (object instanceof String) {
                    value = (String) object;
                } else {
                    continue;
                }
                Element propNode = doc.createElement("property");
                conf.appendChild(propNode);

                Element nameNode = doc.createElement("name");
                nameNode.appendChild(doc.createTextNode(name));
                propNode.appendChild(nameNode);

                Element valueNode = doc.createElement("value");
                valueNode.appendChild(doc.createTextNode(value));
                propNode.appendChild(valueNode);

                conf.appendChild(doc.createTextNode("\n"));
            }

            DOMSource source = new DOMSource(doc);
            StreamResult result = new StreamResult(out);
            TransformerFactory transFactory = TransformerFactory.newInstance();
            Transformer transformer = transFactory.newTransformer();
            transformer.transform(source, result);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
170687
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema,
            XMLOutputFactory outFactory) throws IOException
    {
        XMLStreamWriter writer = null;
        try
        {
            writer = outFactory.createXMLStreamWriter(out, XML_ENCODING);

            writer.writeStartDocument(XML_ENCODING, XML_VERSION);
            writeTo(writer, message, schema);
            writer.writeEndDocument();

            writer.flush();
        }
        catch (XMLStreamException e)
        {
            throw new XmlOutputException(e);
        }
        finally
        {
            if (writer != null)
            {
                try
                {
                    writer.close();
                }
                catch (XMLStreamException e)
                {
                    // ignore
                }
            }
        }
    }
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();
        }
    }
1067725
public void writeEndDocument() throws XMLStreamException {
		try {
			checkPendingATEvents();
			encoder.encodeEndDocument();
			encoder.flush();
		} catch (Exception e) {
			throw new XMLStreamException(e.getLocalizedMessage(), e);
		}
	}
1141475
protected final void xmlWriteChildrenOn(FormattedWriter writer) throws IOException
    {
        super.xmlWriteChildrenOn(writer);
        if (null != _references)
        {
            _references.xmlWriteChildrenOn(writer, XML_REFERENCES);
        }
    }