Package org.apache.tools.ant.util

Examples of org.apache.tools.ant.util.DOMElementWriter


        if (state.equals(testSuite)) {
            File reportFile = new File(testResultsDir, "TEST-" + testClassName + ".xml");
            try {
                OutputStream outstr = new BufferedOutputStream(new FileOutputStream(reportFile));
                try {
                    new DOMElementWriter(true).write(rootElement, outstr);
                } finally {
                    outstr.close();
                }
            } catch (IOException e) {
                throw new GradleException(String.format("Could not write test report file '%s'.", reportFile), e);
View Full Code Here


        if (out != null) {
            Writer wri = null;
            try {
                wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8"));
                wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
                (new DOMElementWriter()).write(rootElement, wri, 0, "  ");
            } catch (IOException exc) {
                throw new BuildException("Unable to write log file", exc);
            } finally {
                if (wri != null) {
                    try {
View Full Code Here

        if (out != null) {
            Writer wri = null;
            try {
                wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8"));
                wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
                (new DOMElementWriter()).write(rootElement, wri, 0, "  ");
            } catch (IOException exc) {
                throw new BuildException("Unable to write log file " + exc.toString(), exc);
            } finally {
                if (wri != null) {
                    try {
View Full Code Here

    return s;
  }

  private static String textOf(XmlNode xml) {
    ByteArrayOutputStream o = new ByteArrayOutputStream();
    new XmlOutputWriter().write(xml, o, new DOMElementWriter());
    return textIn(o);
  }
View Full Code Here

  XmlOutputWriter(StandardOutputStreams outputStreams) {
    this.outputStreams = outputStreams;
  }

  void write(XmlNode xml, OutputStream out) {
    write(xml, out, new DOMElementWriter());
  }
View Full Code Here

        if (out != null) {
            Writer wri = null;
            try {
                wri = new BufferedWriter(new OutputStreamWriter(out, "UTF8"));
                wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
                (new DOMElementWriter()).write(rootElement, wri, 0, "  ");
                wri.flush();
            } catch (IOException exc) {
                throw new BuildException("Unable to write log file", exc);
            } finally {
                if (out != System.out && out != System.err) {
View Full Code Here

        PrintWriter wri = null;
        try {
            out = new FileOutputStream(file);
            wri = new PrintWriter(new OutputStreamWriter(out, "UTF8"));
            wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
            (new DOMElementWriter()).write(doc.getDocumentElement(), wri, 0, "  ");
            wri.flush();
            // writers do not throw exceptions, so check for them.
            if (wri.checkError()){
                throw new IOException("Error while writing DOM content");
            }
View Full Code Here

            out.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
            if (xslUri.length() > 0) {
                out.write("<?xml-stylesheet type=\"text/xsl\" href=\""
                        + xslUri + "\"?>\n\n");
            }
            (new DOMElementWriter()).write(buildElement.element, out, 0, "\t");
            out.flush();
        } catch (IOException exc) {
            throw new BuildException("Unable to write log file", exc);
        } finally {
            if (out != null) {
View Full Code Here

        if (out != null) {
            Writer wri = null;
            try {
                wri = new OutputStreamWriter(out, "UTF8");
                wri.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
                (new DOMElementWriter()).write(rootElement, wri, 0, "  ");
                wri.flush();
            } catch (IOException exc) {
                throw new BuildException("Unable to write log file", exc);
            } finally {
                if (out != System.out && out != System.err) {
View Full Code Here

            rootElement.appendChild(clazz);
        }
        rootElement.setAttribute("violations", String.valueOf(errors));

        // now write it to the outputstream, not very nice code
        DOMElementWriter domWriter = new DOMElementWriter();
        try {
            domWriter.write(rootElement, xmlOut);
        } catch (IOException e){
            throw new BuildException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.util.DOMElementWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.