private void writeXML(Writer out, Project project) throws IOException { Document document = endDocument(project); XMLWriter writer = new XMLWriter(out, OutputFormat.createPrettyPrint()); writer.write(document); }
public String toString(final Reflections reflections) { Document document = createDocument(reflections); try { StringWriter writer = new StringWriter(); XMLWriter xmlWriter = new XMLWriter(writer, OutputFormat.createPrettyPrint()); xmlWriter.write(document); xmlWriter.close(); return writer.toString(); } catch (IOException e) { throw new RuntimeException(); } }
public String toString(final Reflections reflections) { Document document = createDocument(reflections); try { StringWriter writer = new StringWriter(); XMLWriter xmlWriter = new XMLWriter(writer, OutputFormat.createPrettyPrint()); xmlWriter.write(document); xmlWriter.close(); return writer.toString(); } catch (IOException e) { throw new RuntimeException(); } }
public File save(final Reflections reflections, final String filename) { File file = Utils.prepareFile(filename); try { Document document = createDocument(reflections); XMLWriter xmlWriter = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint()); xmlWriter.write(document); xmlWriter.close(); } catch (IOException e) { throw new ReflectionsException("could not save to file " + filename, e); } catch (Throwable e) { throw new RuntimeException("Could not save to file " + filename + ". Make sure relevant dependencies exist on classpath.", e); } return file; }
/** * @since 1.4 */ public Dom4JDriver(NameCoder nameCoder) { this(new DocumentFactory(), OutputFormat.createPrettyPrint(), nameCoder); outputFormat.setTrimText(false); }
public File save(final Reflections reflections, final String filename) { File file = Utils.prepareFile(filename); try { Document document = createDocument(reflections); XMLWriter xmlWriter = new XMLWriter(new FileOutputStream(file), OutputFormat.createPrettyPrint()); xmlWriter.write(document); xmlWriter.close(); } catch (IOException e) { throw new ReflectionsException("could not save to file " + filename, e); } catch (Throwable e) { throw new RuntimeException("Could not save to file " + filename + ". Make sure relevant dependencies exist on classpath.", e); } return file; }
OutputFormat prettyPrinter = OutputFormat.createPrettyPrint(); XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter); xmlWriter.write(document);
@SuppressFBWarnings("DM_EXIT") public static void main(String[] args) throws Exception { if (args.length != 2) { System.err.println("Usage: " + AddMessages.class.getName() + " <input collection> <output collection>"); System.exit(1); } // Load plugins, in order to get message files DetectorFactoryCollection.instance(); String inputFile = args[0]; String outputFile = args[1]; Project project = new Project(); SortedBugCollection inputCollection = new SortedBugCollection(project); inputCollection.readXML(inputFile); Document document = inputCollection.toDocument(); AddMessages addMessages = new AddMessages(inputCollection, document); addMessages.execute(); XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(outputFile)), OutputFormat.createPrettyPrint()); writer.write(document); writer.close(); } }
doc = reader.read(in); OutputFormat formater = OutputFormat.createPrettyPrint();
OutputFormat prettyPrinter = OutputFormat.createPrettyPrint(); XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter); xmlWriter.write(xmlResponse);
OutputFormat prettyPrinter = OutputFormat.createPrettyPrint(); XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter); try {
OutputFormat prettyPrinter = OutputFormat.createPrettyPrint(); XMLWriter xmlWriter = new XMLWriter(writer, prettyPrinter); xmlWriter.write(xml);
/** * 把document对象写入新的文件 * * @param document * @throws Exception */ public static void writer(Document document, OutputStreamWriter outputStream, String encoding) throws Exception { OutputFormat format = OutputFormat.createPrettyPrint(); format.setEncoding(encoding); XMLWriter writer = new XMLWriter(outputStream, format); writer.write(document); writer.flush(); writer.close(); }
/** 输出DOM。 */ public static void writeDocument(Document doc, Writer writer, String charset) throws IOException { charset = defaultIfEmpty(trimToNull(charset), "UTF-8"); OutputFormat format = OutputFormat.createPrettyPrint(); format.setEncoding(charset); format.setIndent(true); format.setIndentSize(4); XMLWriter xmlWriter = new XMLWriter(writer, format); xmlWriter.write(doc); xmlWriter.flush(); }
/** 输出DOM。 */ public static void writeDocument(Document doc, Writer writer, String charset) throws IOException { charset = defaultIfEmpty(trimToNull(charset), "UTF-8"); OutputFormat format = OutputFormat.createPrettyPrint(); format.setEncoding(charset); format.setIndent(true); format.setIndentSize(4); XMLWriter xmlWriter = new XMLWriter(writer, format); xmlWriter.write(doc); xmlWriter.flush(); }
/** 输出DOM。 */ public static void writeDocument(Document doc, Writer writer, String charset) throws IOException { charset = defaultIfEmpty(trimToNull(charset), "UTF-8"); OutputFormat format = OutputFormat.createPrettyPrint(); format.setEncoding(charset); format.setIndent(true); format.setIndentSize(4); XMLWriter xmlWriter = new XMLWriter(writer, format); xmlWriter.write(doc); xmlWriter.flush(); }
OutputFormat format=OutputFormat.createPrettyPrint(); format.setEncoding("utf-8"); XMLWriter writer=new XMLWriter(out,format);
org.dom4j.DocumentException { StringWriter sw = new StringWriter(); OutputFormat format = OutputFormat.createPrettyPrint(); format.setNewlines(newlines); format.setTrimText(trim);
OutputFormat format = org.dom4j.io.OutputFormat.createPrettyPrint();
public void testBug923882asWriterWithEmptyCharArray() throws Exception { // use an the HTMLWriter sax-methods. // StringWriter buffer = new StringWriter(); HTMLWriter writer = new HTMLWriter(buffer, OutputFormat .createPrettyPrint()); writer.characters("wor".toCharArray(), 0, 3); writer.characters(new char[0], 0, 0); writer.characters("d-being-cut".toCharArray(), 0, 11); String expected = "word-being-cut"; assertEquals(expected, buffer.toString()); }