Package org.apache.tools.ant.util

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


    protected void writeDOMTree(Document doc, File file) throws IOException {
        OutputStream os = new FileOutputStream(file);
        try {
            PrintWriter wri = new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(os), "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


            // up everything
            Writer out =
                new OutputStreamWriter(new FileOutputStream(outFilename),
                                       "UTF8");
            out.write("<?xml:stylesheet type=\"text/xsl\" href=\"log.xsl\"?>\n\n");
                      (new DOMElementWriter()).write(buildElement.element, out, 0, "\t");
            out.flush();
            out.close();
           
        } catch(IOException exc) {
            throw new BuildException("Unable to close log file", exc);
View Full Code Here

            Writer out =
                new OutputStreamWriter(new FileOutputStream(outFilename),
                                       "UTF8");
            out.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
            out.write("<?xml:stylesheet type=\"text/xsl\" href=\"log.xsl\"?>\n\n");
                      (new DOMElementWriter()).write(buildElement.element, out, 0, "\t");
            out.flush();
            out.close();
           
        } catch(IOException exc) {
            throw new BuildException("Unable to close log file", exc);
View Full Code Here

        if (out != null) {
            Writer wri = null;
            try {
                wri = new OutputStreamWriter(out, "UTF8");
                wri.write("<?xml version=\"1.0\"?>\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

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

     */
    protected void writeDOMTree(Document doc, File file) throws IOException {
        OutputStream out = new FileOutputStream( file );
        PrintWriter wri = new PrintWriter(new OutputStreamWriter(out, "UTF8"));
        wri.write("<?xml version=\"1.0\"?>\n");
        (new DOMElementWriter()).write(doc.getDocumentElement(), wri, 0, "  ");
        wri.flush();
        wri.close();
        // writers do not throw exceptions, so check for them.
        if (wri.checkError()){
            throw new IOException("Error while writing DOM content");
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 BufferedOutputStream(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

            f = FileUtils.getFileUtils().createTempFile("build", ".xml", null);
            f.deleteOnExit();
            FileOutputStream out = null;
            try {
                out = new FileOutputStream(f);
                DOMElementWriter w =
                    new DOMElementWriter(true,
                                         DOMElementWriter.XmlNamespacePolicy
                                         .ONLY_QUALIFY_ELEMENTS);
                w.write(e, out);
            } finally {
                if (out != null) {
                    out.close();
                }
            }
View Full Code Here

        PrintWriter wri = null;
        try {
            out = new BufferedOutputStream(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

TOP

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

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.