/* */ public SerializationHandler openOutputHandler(String filename, boolean append) /* */ throws TransletException /* */ { /* */ try /* */ { /* 552 */ TransletOutputHandlerFactory factory = TransletOutputHandlerFactory.newInstance(); /* */ /* 555 */ String dirStr = new File(filename).getParent(); /* 556 */ if ((null != dirStr) && (dirStr.length() > 0)) { /* 557 */ File dir = new File(dirStr); /* 558 */ dir.mkdirs(); /* */ } /* */ /* 561 */ factory.setEncoding(this._encoding); /* 562 */ factory.setOutputMethod(this._method); /* 563 */ factory.setOutputStream( new BufferedOutputStream(new FileOutputStream(filename, append))); /* 564 */ factory.setOutputType(0); /* */ /* 566 */ SerializationHandler handler = factory.getSerializationHandler(); /* */ /* 569 */ transferOutputSettings(handler); /* 570 */ handler.startDocument(); /* 571 */ return handler; /* */ } /* */ catch (Exception e) { /* 574 */ throw new TransletException(e); /* */ } /* */ }
/* */ public void closeOutputHandler(SerializationHandler handler) { /* */ try { /* 586 */ handler.endDocument(); /* 587 */ handler.close(); /* */ } /* */ catch (Exception e) /* */ { /* */ } /* */ }
/* */ public final void characters(String string, SerializationHandler handler) /* */ throws TransletException /* */ { /* 624 */ if (string != null) /* */ try /* */ { /* 627 */ handler.characters(string); /* */ } catch (Exception e) { /* 629 */ throw new TransletException(e); /* */ } /* */ }
/* */ protected void transferOutputSettings(SerializationHandler handler) /* */ { /* 659 */ if (this._method != null) { /* 660 */ if (this._method.equals("xml")) { /* 661 */ if (this._standalone != null) { /* 662 */ handler.setStandalone(this._standalone); /* */ } /* 664 */ if (this._omitHeader) { /* 665 */ handler.setOmitXMLDeclaration(true); /* */ } /* 667 */ handler.setCdataSectionElements(this._cdata); /* 668 */ if (this._version != null) { /* 669 */ handler.setVersion(this._version); /* */ } /* 671 */ handler.setIndent(this._indent); /* 672 */ handler.setIndentAmount(this._indentamount); /* 673 */ if (this._doctypeSystem != null) { /* 674 */ handler.setDoctype(this._doctypeSystem, this._doctypePublic); /* */ } /* 676 */ handler.setIsStandalone(this._isStandalone); /* */ } /* 678 */ else if (this._method.equals("html")) { /* 679 */ handler.setIndent(this._indent); /* 680 */ handler.setDoctype(this._doctypeSystem, this._doctypePublic); /* 681 */ if (this._mediaType != null) /* 682 */ handler.setMediaType(this._mediaType); /* */ } /* */ } /* */ else /* */ { /* 687 */ handler.setCdataSectionElements(this._cdata); /* 688 */ if (this._version != null) { /* 689 */ handler.setVersion(this._version); /* */ } /* 691 */ if (this._standalone != null) { /* 692 */ handler.setStandalone(this._standalone); /* */ } /* 694 */ if (this._omitHeader) { /* 695 */ handler.setOmitXMLDeclaration(true); /* */ } /* 697 */ handler.setIndent(this._indent); /* 698 */ handler.setDoctype(this._doctypeSystem, this._doctypePublic); /* 699 */ handler.setIsStandalone(this._isStandalone); /* */ } /* */ }