convert Configuration to an XML file so it can be serialized

@param pw
@return XMLWriter
@throws IOException
170534
public XMLWriter toXML(PrintWriter pw)
			throws IOException
			{

		XMLWriter     xw = new PrettyXMLWriter( pw);

		toXML(xw);
		return xw ;
			}
335158
public String toXml() throws ProjectException {
        log.debug("Writing xml");

        Project copy = this;
        copy.removeProperty( "project.basedir" );

        StringWriter writer = new StringWriter();

        MavenXpp3Writer pomWriter = new MavenXpp3Writer();
        try {
            pomWriter.write(writer, copy.mavenModel);
        } catch (IOException e) {
            throw new ProjectException("Failed to create pom xml", e);
        }

        writer.flush();
        return writer.toString();
    }
606469
protected void xmlWriteChildrenOn(FormattedWriter writer) throws IOException 
    {
        super.xmlWriteChildrenOn(writer);
        if (null != _items)
        {
            _items.xmlWriteChildrenOn(writer, XML_ITEMS);
        }
        if (null != _itemStreams)
        {
            _itemStreams.xmlWriteOn(writer, XML_ITEM_STREAMS);
        }
        if (null != _referenceStreams)
        {
            _referenceStreams.xmlWriteOn(writer, XML_REFERENCE_STREAMS);
        }
    }
1152432
public void dumpRaw(FormattedWriter fw)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "dumpRaw");

        try
        {
            xmlRequestWriteRawDataOnFile(fw);
        } catch (IOException e)
        {
            // No FFDC Code Needed
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                SibTr.event(this, tc, "Exception caught writing Mmessage store dump!", e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "dumpRaw");
    }
1146935
@SuppressWarnings("resource")
    private XMLStreamWriter2 createSW(OutputStream out, Writer w, String enc,
                                      boolean requireAutoClose)
        throws XMLStreamException
    {
        /* Need to ensure that the configuration object is not shared
         * any more; otherwise later changes via factory could be
         * visible half-way through output...
         */
        WriterConfig cfg = mConfig.createNonShared();
        XmlWriter xw;

        boolean autoCloseOutput = requireAutoClose || mConfig.willAutoCloseOutput();

        if (w == null) {
            if (enc == null) {
                enc = WstxOutputProperties.DEFAULT_OUTPUT_ENCODING;
            } else {
                /* Canonical ones are interned, so we may have
                 * normalized encoding already...
                 */
                if (enc != CharsetNames.CS_UTF8
                    && enc != CharsetNames.CS_ISO_LATIN1
                    && enc != CharsetNames.CS_US_ASCII) {
                    enc = CharsetNames.normalize(enc);
                }
            }

            try {
                if (enc == CharsetNames.CS_UTF8) {
                    w = new UTF8Writer(cfg, out, autoCloseOutput);
                    xw = new BufferingXmlWriter(w, cfg, enc, autoCloseOutput, out, 16);
                } else if (enc == CharsetNames.CS_ISO_LATIN1) {
                    xw = new ISOLatin1XmlWriter(out, cfg, autoCloseOutput);
                } else if (enc == CharsetNames.CS_US_ASCII) {
                    xw = new AsciiXmlWriter(out, cfg, autoCloseOutput);
                } else {
                    w = new OutputStreamWriter(out, enc);
                    xw = new BufferingXmlWriter(w, cfg, enc, autoCloseOutput, out, -1);
                }
            } catch (IOException ex) {
                throw new XMLStreamException(ex);
            }
        } else {
            // we may still be able to figure out the encoding:
            if (enc == null) {
                enc = CharsetNames.findEncodingFor(w);
            }
            try {
                xw = new BufferingXmlWriter(w, cfg, enc, autoCloseOutput, null, -1);
            } catch (IOException ex) {
                throw new XMLStreamException(ex);
            }
        }

        return createSW(enc, cfg, xw);
    }
328194
public static byte[] serializeDoc(Node n) throws IOException {
        XmlDomWriter xw = new XmlDomWriter();
        ByteArrayOutputStream fout = new ByteArrayOutputStream();
        xw.setOutput(fout, null);
        xw.setCanonical(false);
        xw.write(n);
        fout.close();
        return fout.toByteArray();
    }
1164163
public void build() throws IOException {
        if (! serialClassFoundToDocument(configuration.root.classes())) {
            //Nothing to document.
            return;
        }
        try {
            writer = configuration.getWriterFactory().getSerializedFormWriter();
            if (writer == null) {
                //Doclet does not support this output.
                return;
            }
        } catch (Exception e) {
            throw new DocletAbortException(e);
        }
        build(layoutParser.parseXML(NAME), contentTree);
        writer.close();
    }
1354652
public void xmlWriteOn(FormattedWriter writer) throws IOException
  {
      writer.newLine();
      writer.taggedValue("remoteMEId", remoteMEId);
      writer.newLine();
      writer.taggedValue("streamId", streamId);
      writer.newLine();
      writer.taggedValue("gatheringTargetDestUuid", gatheringTargetDestUuid);
  }
445368
public final void xmlRequestWriteOnSystemOut() throws IOException, NotInMessageStore
    {
        Membership membership = _getMembership();
        if (null == membership)
        {
            throw new NotInMessageStore();
        }
        if (null != membership)
        {
            FormattedWriter writer = new FormattedWriter(new OutputStreamWriter(System.out));
            membership.requestXmlWriteOn(writer);
            writer.flush();
        }
    }
1370673
protected XMLStreamWriter2 createSW(String enc, WriterConfig cfg, XmlWriter xw) {
        if (cfg.willSupportNamespaces()) {
            if (cfg.automaticNamespacesEnabled()) {
                return new RepairingNsStreamWriter(xw, enc, cfg);
            }
            return new SimpleNsStreamWriter(xw, enc, cfg);
        }
        return new NonNsStreamWriter(xw, enc, cfg);
    }
309207
@Override
    public void xmlWriteOn(FormattedWriter writer) throws IOException
    {
        writer.startTag(XML_MESSAGE_STORE);
        writer.indent();
        synchronized (_startLock)
        {
            if (_state == MessageStoreState.STATE_STARTED)
            {
                _rootMembership.xmlWriteItemStreamsOn(writer);
            }
            else
            {
                writer.newLine();
                writer.write(XML_CANNOT_BE_WRITTEN);
            }
        }

        if (null != _itemStorageManager)
        {
            _itemStorageManager.xmlWriteOn(writer);
        }

        if (null != _membershipMap)
        {
            _membershipMap.xmlWriteOn(writer);
        }

        if (null != _persistentMessageStore)
        {
            _persistentMessageStore.xmlWriteOn(writer);
        }

        if (null != _expirer)
        {
            _expirer.xmlWriteOn(writer);
        }

        if (null != _cacheLoader)
        {
            _cacheLoader.xmlWriteOn(writer);
        }

        if (null != _deliveryDelayManager) {
            _deliveryDelayManager.xmlWriteOn(writer);
        }
        writer.outdent();
        writer.newLine();
        writer.endTag(XML_MESSAGE_STORE);
    }
216363
public String toXml() throws TwiMLException {
        try {
            Document doc = DocumentBuilderFactory
                .newInstance()
                .newDocumentBuilder()
                .newDocument();
            doc.setXmlStandalone(true);
            doc.appendChild(this.buildXmlElement(doc));

            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.setOutputProperty(OutputKeys.INDENT, "no");
            DOMSource source = new DOMSource(doc);
            StreamResult output = new StreamResult(new StringWriter());
            transformer.transform(source, output);
            return output.getWriter().toString().trim();
        } catch (TransformerException te) {
            throw new TwiMLException("Exception serializing TwiML: " + te.getMessage());
        } catch (Exception e) {
            throw new TwiMLException("Unhandled exception: " + e.getMessage());
        }
    }
1055959
protected void writeHeader()
		throws ConfigurationException, IOException
	{

		if (writer != null) {
			writer.close();
		}

		this.fileCounter++;
		String filePath = PATH_OUTPUT_SQL_FILES + this.outputName + "_"
				+ fileCounter + ".sql";

		SQLConsumerLogMessages.logFileCreation(logger, filePath);

		this.sqlFile = new File(filePath);

		this.writer = new BufferedWriter(new OutputStreamWriter(new BufferedOutputStream(
		        new FileOutputStream(filePath)), WIKIPEDIA_ENCODING));

;



		String[] revTable = this.sqlEncoder.getTable();

		for (String sTable : revTable) {
			this.writer.write(sTable + "\r\n");
		}

		this.writer.flush();
	}
965610
@Override
    public void xmlWriteOn(FormattedWriter writer) throws IOException
    {
        super.xmlWriteOn(writer);
        writer.newLine();
        writer.taggedValue("toBeDeleted", _toBeDeleted);
        writer.newLine();
        writer.taggedValue("toBeIgnored", _toBeIgnored);
    }
1194161
private XMLEventWriter createXmlEventWriter(FileWriter fileWriter)
            throws FactoryConfigurationError, XMLStreamException {
        XMLOutputFactory factory = XMLOutputFactory.newInstance();
        return new IndentingXMLEventWriter(factory
                .createXMLEventWriter(fileWriter));
    }
629054
private void writeXML(String xml) {
        String resourceName = System.getProperty(CONFIG_FILENAME_KEY);
        if (resourceName == null) {
            return;
        } else {
            URL rUrl = ClassLoader.getSystemResource(resourceName);
            if (rUrl != null) {
                File file = new File(rUrl.getFile());
                if (file != null && file.canWrite()) {
                    FileWriter fw = null;
                    try {
                        fw = new FileWriter(file);
                        fw.write(xml);
                        fw.close();
                    } catch (IOException ioe) {
                        //@TODO log it?
                    } finally {
                        try {
                            fw.close();
                        } catch (IOException ioee) {
                            ; //Nothing to do.
                        }
                        fw = null;
                        file = null;
                    }
                }
            }
        }
    }
1001572
public final void xmlRequestWriteRawDataOnSystemOut() throws IOException
    {
        FormattedWriter writer = new FormattedWriter(new OutputStreamWriter(System.out));
        xmlWriteRawOn(writer, false);
        writer.flush();
    }