/** * Create a processor that writes to the file named and may or may not * also output to the screen, as specified. * * @param filename Name of file to write output to * @param printToScreen Mirror output to screen? */ public XmlEditsVisitor(OutputStream out) throws IOException { this.out = out; OutputFormat outFormat = new OutputFormat("XML", "UTF-8", true); outFormat.setIndenting(true); outFormat.setIndent(2); outFormat.setDoctype(null, null); XMLSerializer serializer = new XMLSerializer(out, outFormat); contentHandler = serializer.asContentHandler(); try { contentHandler.startDocument(); contentHandler.startElement("", "", "EDITS", new AttributesImpl()); } catch (SAXException e) { throw new IOException("SAX error: " + e.getMessage()); } }
/** * Create a processor that writes to the file named and may or may not * also output to the screen, as specified. * * @param filename Name of file to write output to * @param printToScreen Mirror output to screen? */ public XmlEditsVisitor(OutputStream out) throws IOException { this.out = out; OutputFormat outFormat = new OutputFormat("XML", "UTF-8", true); outFormat.setIndenting(true); outFormat.setIndent(2); outFormat.setDoctype(null, null); XMLSerializer serializer = new XMLSerializer(out, outFormat); contentHandler = serializer.asContentHandler(); try { contentHandler.startDocument(); contentHandler.startElement("", "", "EDITS", new AttributesImpl()); } catch (SAXException e) { throw new IOException("SAX error: " + e.getMessage()); } }
public SerializingUserLayoutDao() { layoutOutputFormat=new OutputFormat(); layoutOutputFormat.setIndenting(true); layoutOutputFormat.setLineWidth(0); layoutOutputFormat.setOmitDocumentType(false); layoutOutputFormat.setPreserveSpace(true); layoutOutputFormat.setEncoding("UTF-8"); layoutOutputFormat.setOmitComments(false); layoutOutputFormat.setOmitXMLDeclaration(false); layoutOutputFormat.setDoctype(publicDoctype, systemDoctype); }
/** * Constructs a new output format with the proper method, * document type identifiers and media type for the specified * document. * * @param doc The document to output * @see #whichMethod */ public OutputFormat( Document doc ) { setMethod( whichMethod( doc ) ); setDoctype( whichDoctypePublic( doc ), whichDoctypeSystem( doc ) ); setMediaType( whichMediaType( getMethod() ) ); }