if (enc == CharsetNames.CS_UTF8) {
/* 16-Aug-2006, TSa: Note: utf8 writer may or may not
* need to close the stream it has, but buffering
* xml writer must call close on utf8 writer. Thus:
*/
w = new UTF8Writer(cfg, out, autoCloseOutput);
xw = new BufferingXmlWriter(w, cfg, enc, true, out);
} 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);