public static void write( XMLWriter xmlWriter, Xpp3Dom dom ) { write( xmlWriter, dom, true ); }
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 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 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 ); }
public void writeToSerializer( String namespace, XmlSerializer serializer, Xpp3Dom dom ) throws IOException { // TODO: WARNING! Later versions of plexus-utils psit out an <?xml ?> header due to thinking this is a new // document - not the desired behaviour! SerializerXMLWriter xmlWriter = new SerializerXMLWriter( namespace, serializer ); Xpp3DomWriter.write( xmlWriter, dom ); if ( xmlWriter.getExceptions().size() > 0 ) { throw (IOException) xmlWriter.getExceptions().get( 0 ); } }
public void writeToSerializer( String namespace, XmlSerializer serializer ) throws IOException { // TODO: WARNING! Later versions of plexus-utils psit out an <?xml ?> header due to thinking this is a new // document - not the desired behaviour! SerializerXMLWriter xmlWriter = new SerializerXMLWriter( namespace, serializer ); Xpp3DomWriter.write( xmlWriter, this ); if ( xmlWriter.getExceptions().size() > 0 ) { throw (IOException) xmlWriter.getExceptions().get( 0 ); } }
public static void write( XMLWriter xmlWriter, Xpp3Dom dom, boolean escape ) { // TODO: move to XMLWriter? xmlWriter.startElement( dom.getName() ); String[] attributeNames = dom.getAttributeNames(); for ( String attributeName : attributeNames ) { xmlWriter.addAttribute( attributeName, dom.getAttribute( attributeName ) ); } Xpp3Dom[] children = dom.getChildren(); for ( Xpp3Dom aChildren : children ) { write( xmlWriter, aChildren, escape ); } String value = dom.getValue(); if ( value != null ) { if ( escape ) { xmlWriter.writeText( value ); } else { xmlWriter.writeMarkup( value ); } } xmlWriter.endElement(); }
public static void write(Feature feature, File file) throws IOException { Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); try { Xpp3DomWriter.write(writer, feature.dom); } finally { writer.close(); } }
public static void write(UpdateSite site, File file) throws IOException { Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); try { Xpp3DomWriter.write(writer, site.dom); } finally { writer.close(); } }
public static void write(ProductConfiguration product, File file) throws IOException { Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); try { Xpp3DomWriter.write(writer, product.dom); } finally { writer.close(); } }
public static void write( Target target, File file ) throws IOException { Writer writer = new OutputStreamWriter( new FileOutputStream( file ), "UTF-8" ); try { Xpp3DomWriter.write( writer, target.dom ); } finally { writer.close(); } }
public static void write(Platform platform, File file) throws IOException { file.getParentFile().mkdirs(); Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); try { Xpp3DomWriter.write(writer, platform.dom); } finally { writer.close(); } }
public static void write(Platform platform, File file) throws IOException { file.getParentFile().mkdirs(); Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); try { Xpp3DomWriter.write(writer, platform.dom); } finally { writer.close(); } }
public static void write(Platform platform, File file) throws IOException { file.getParentFile().mkdirs(); Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); try { Xpp3DomWriter.write(writer, platform.dom); } finally { writer.close(); } }
public static void write(Platform platform, File file) throws IOException { file.getParentFile().mkdirs(); Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); try { Xpp3DomWriter.write(writer, platform.dom); } finally { writer.close(); } }
@Override public synchronized void print(Xpp3Dom element) { Xpp3DomWriter.write(xmlWriter, element); XmlWriterUtil.writeLineBreak(xmlWriter); out.flush(); }
private static void writeMetadata( File metadataFile, Xpp3Dom metadata ) throws IOException { metadataFile.getParentFile().mkdirs(); try ( Writer writer = WriterFactory.newXmlWriter( metadataFile ) ) { Xpp3DomWriter.write( writer, metadata ); } }
@Override public synchronized void print(Xpp3Dom element) { element.setAttribute("_time", new Timestamp(System.currentTimeMillis()).toString()); Xpp3DomWriter.write(xmlWriter, element); XmlWriterUtil.writeLineBreak(xmlWriter); }
/** * write back a domtree to a xmlfile and use the pretty print for it so that it is human readable. * * @param xmlFile file to write to * @param xmlDomTree dom-tree to write * @throws MojoExecutionException if the file could not be written */ private void writePrettyXmlFile( File xmlFile, Xpp3Dom xmlDomTree ) throws MojoExecutionException { Xpp3Dom original = readXMLFile( xmlFile ); if ( original != null && original.equals( xmlDomTree ) ) { this.log.info( "Rad6CleanMojo.unchanged" + xmlFile.getAbsolutePath() ); return; } Writer w; xmlFile.getParentFile().mkdirs(); try { w = new OutputStreamWriter( new FileOutputStream( xmlFile ), "UTF-8" ); } catch ( IOException ex ) { throw new MojoExecutionException( "Rad6Plugin.erroropeningfile", ex ); //$NON-NLS-1$ } XMLWriter writer = new PrettyPrintXMLWriter( w, "UTF-8", null ); Xpp3DomWriter.write( writer, xmlDomTree ); IOUtil.close( w ); }