public String toUnescapedString() { // TODO: WARNING! Later versions of plexus-utils psit out an <?xml ?> header due to thinking this is a new // document - not the desired behaviour! StringWriter writer = new StringWriter(); XMLWriter xmlWriter = new PrettyPrintXMLWriter( writer, "UTF-8", null ); Xpp3DomWriter.write( xmlWriter, this, false ); return writer.toString(); }
public String toString() { // TODO: WARNING! Later versions of plexus-utils psit out an <?xml ?> header due to thinking this is a new // document - not the desired behaviour! StringWriter writer = new StringWriter(); XMLWriter xmlWriter = new PrettyPrintXMLWriter( writer, "UTF-8", null ); Xpp3DomWriter.write( xmlWriter, this ); return writer.toString(); }
public static void write( Writer writer, Xpp3Dom dom ) { write( new PrettyPrintXMLWriter( writer ), dom ); }
public static void write( PrintWriter writer, Xpp3Dom dom ) { write( new PrettyPrintXMLWriter( writer ), dom ); }
writer = new OutputStreamWriter( os ); final PrettyPrintXMLWriter xmlWriter = new PrettyPrintXMLWriter( writer ); xmlWriter.setLineIndenter( StringUtils.repeat( " ", indentSize ) ); xmlWriter.setLineSeparator( lineSeparator );
PrettyPrintXMLWriter xmlWriter = new PrettyPrintXMLWriter( writer ); xmlWriter.setLineIndenter( StringUtils.repeat( " ", indentSize ) ); xmlWriter.setLineSeparator( lineSeparator );
private XmlWriterXdocSink( StringWriter out, String encoding ) { super( out, encoding ); this.xdocWriter = out; this.xmlWriter = new PrettyPrintXMLWriter( out ); }
protected XMLWriter initializeXmlWriter(final Writer writer, final String docType) { return new PrettyPrintXMLWriter(writer, encoding, docType); }
/** {@inheritDoc} */ public void tableCaption( SinkEventAttributes attributes ) { StringWriter sw = new StringWriter(); this.tableCaptionWriterStack.addLast( sw ); this.tableCaptionXMLWriterStack.addLast( new PrettyPrintXMLWriter( sw ) ); // <fo:table-caption> is XSL-FO 1.0 standard but not implemented in FOP 0.95 //writeStartTag( TABLE_CAPTION_TAG ); // TODO: how to implement this otherwise? // table-footer doesn't work because it has to be declared before table-body. }
public void write(PlexusConfiguration configuration, Writer writer) throws IOException { int depth = 0; PrettyPrintXMLWriter xmlWriter = new PrettyPrintXMLWriter(writer); write(configuration, xmlWriter, depth); }
/** * @param configuration {@link PlexusConfiguration} * @param writer {@link Writer} * @throws IOException In case of problems. */ public void write( PlexusConfiguration configuration, Writer writer ) throws IOException { final int depth = 0; PrettyPrintXMLWriter xmlWriter = new PrettyPrintXMLWriter( writer ); write( configuration, xmlWriter, depth ); }
public OutputStreamEventReporter(Writer out) { if (out instanceof PrintWriter) { this.out = (PrintWriter) out; } else { this.out = new PrintWriter(out, true); } this.xmlWriter = new PrettyPrintXMLWriter(out); xmlWriter.startElement("mavenExecution"); }
/** * @param mojoDescriptor not null * @param destinationDirectory not null * @throws IOException if any */ protected void processMojoDescriptor( MojoDescriptor mojoDescriptor, File destinationDirectory ) throws IOException { File outputFile = new File( destinationDirectory, getMojoFilename( mojoDescriptor, "xml" ) ); String encoding = "UTF-8"; try ( Writer writer = new OutputStreamWriter( new FileOutputStream( outputFile ), encoding ) ) { XMLWriter w = new PrettyPrintXMLWriter( new PrintWriter( writer ), encoding, null ); writeBody( mojoDescriptor, w ); writer.flush(); } }
@Override protected Object init(final Object noContext) { if ( xmlOutputFile != null ) { xmlOutputFile.getParentFile().mkdirs(); try { final Context ctx = new Context(); ctx.writer = new FileWriter( xmlOutputFile ); ctx.xmlWriter = new PrettyPrintXMLWriter( ctx.writer ); return ctx; } catch ( IOException e ) { getLog().warn( "No XML report will be produced, cannot write data to " + xmlOutputFile, e ); } } return null; }
/** * @see org.apache.maven.plugin.eclipse.writers.EclipseWriter#write() */ public void write() throws MojoExecutionException { // create a .settings directory (if not existing) File settingsDir = new File( config.getEclipseProjectDirectory(), DIR_WTP_SETTINGS ); settingsDir.mkdirs(); Writer w; String packaging = config.getPackaging(); // Write out facet core xml try { w = new OutputStreamWriter( new FileOutputStream( new File( settingsDir, FILE_FACET_CORE_XML ) ), "UTF-8" ); } catch ( IOException ex ) { throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$ } XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null ); writeModuleTypeFacetCore( writer, packaging ); IOUtil.close( w ); }
/** * write the websettings file for RAD6 if needed. * * @throws MojoExecutionException when writing the config files was not possible */ public void write() throws MojoExecutionException { Writer w; if ( Constants.PROJECT_PACKAGING_WAR.equalsIgnoreCase( config.getPackaging() ) ) { try { w = new OutputStreamWriter( new FileOutputStream( new File( config.getEclipseProjectDirectory(), WEBSETTINGS_FILENAME ) ), "UTF-8" ); } catch ( IOException ex ) { throw new MojoExecutionException( Messages.getString( "EclipsePlugin.erroropeningfile" ), ex ); //$NON-NLS-1$ } XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null ); writeModuleTypeFacetCore( writer ); IOUtil.close( w ); } }
public void writeDescriptorSet( Writer writer, ComponentSetDescriptor componentSetDescriptor, boolean containerDescriptor ) throws ComponentDescriptorWriteException, IOException { try { XMLWriter w = new PrettyPrintXMLWriter( writer ); w.startElement( containerDescriptor ? "plexus" : "component-set" ); writeComponents( w, componentSetDescriptor.getComponents() ); writeDependencies( w, componentSetDescriptor.getDependencies() ); w.endElement(); writer.write( LS ); // Flush, but don't close the writer... we are not its owner writer.flush(); } catch ( PlexusConfigurationException e ) { throw new ComponentDescriptorWriteException( "Internal error while writing out the configuration", e ); } }
private void writeEclipseMetadataXml(OutputStream out, List<String> goals) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8"); XMLWriter w = new PrettyPrintXMLWriter(writer, "UTF-8", null); w.writeMarkup("\n<!-- Generated by " + this.getClass().getSimpleName() + " -->\n\n"); w.startElement("lifecycleMappingMetadata"); if (!goals.isEmpty()) { w.startElement("pluginExecutions"); w.startElement("pluginExecution"); w.startElement("pluginExecutionFilter"); w.startElement("goals"); goals.forEach(g -> writeGoalElement(w, g)); w.endElement(); // goals w.endElement(); // pluginExecutionFilter w.startElement("action"); w.startElement("configurator"); w.startElement("id"); w.writeText("io.takari.m2e.incrementalbuild.builderMojoExecutionConfigurator"); w.endElement(); // id w.endElement(); // configurator w.endElement(); // action w.endElement(); // pluginExecution w.endElement(); // pluginExecutions } w.endElement(); // lifecycleMappingMetadata writer.close(); }
public void writeDescriptor(OutputStream outputStream, PluginDescriptor pluginDescriptor) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding); XMLWriter w = new PrettyPrintXMLWriter(writer, encoding, null); w.writeMarkup("\n<!-- Generated by takari-plugin-tools -->\n\n"); w.startElement("plugin"); element(w, "name", pluginDescriptor.getName()); element(w, "description", pluginDescriptor.getDescription()); element(w, "groupId", pluginDescriptor.getGroupId()); element(w, "artifactId", pluginDescriptor.getArtifactId()); element(w, "version", pluginDescriptor.getVersion()); element(w, "goalPrefix", pluginDescriptor.getGoalPrefix()); element(w, "isolatedRealm", String.valueOf(pluginDescriptor.isIsolatedRealm())); element(w, "inheritedByDefault", String.valueOf(pluginDescriptor.isInheritedByDefault())); writeMojos(w, pluginDescriptor); writeDependencies(w, pluginDescriptor); w.endElement(); writer.flush(); }
public void writeDescriptor(OutputStream outputStream, PluginDescriptor pluginDescriptor) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding); XMLWriter w = new PrettyPrintXMLWriter(writer, encoding, null); w.writeMarkup("\n<!-- Generated by takari-plugin-tools -->\n\n"); w.startElement("plugin"); element(w, "name", pluginDescriptor.getName()); element(w, "description", pluginDescriptor.getDescription()); element(w, "groupId", pluginDescriptor.getGroupId()); element(w, "artifactId", pluginDescriptor.getArtifactId()); element(w, "version", pluginDescriptor.getVersion()); element(w, "goalPrefix", pluginDescriptor.getGoalPrefix()); element(w, "isolatedRealm", String.valueOf(pluginDescriptor.isIsolatedRealm())); element(w, "inheritedByDefault", String.valueOf(pluginDescriptor.isInheritedByDefault())); writeMojos(w, pluginDescriptor); writeDependencies(w, pluginDescriptor); w.endElement(); writer.flush(); }