FileDocCategorySizeDatePackage
EchoXML.javaAPI DocApache Ant 1.702682Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.taskdefs

EchoXML

public class EchoXML extends org.apache.tools.ant.util.XMLFragment
Echo XML. Known limitations:
  1. Currently no XMLNS support
  2. Processing Instructions get ignored
  3. Encoding is always UTF-8
since
Ant 1.7

Fields Summary
private File
file
private boolean
append
private static final String
ERROR_NO_XML
Constructors Summary
Methods Summary
public voidexecute()
Execute the task.

        DOMElementWriter writer = new DOMElementWriter(!append);
        OutputStream os = null;
        try {
            if (file != null) {
                os = new FileOutputStream(file.getAbsolutePath(), append);
            } else {
                os = new LogOutputStream(this, Project.MSG_INFO);
            }
            Node n = getFragment().getFirstChild();
            if (n == null) {
                throw new BuildException(ERROR_NO_XML);
            }
            writer.write((Element) n, os);
        } catch (BuildException e) {
            throw e;
        } catch (Exception e) {
            throw new BuildException(e);
        } finally {
            FileUtils.close(os);
        }
    
public voidsetAppend(boolean b)
Set whether to append the output file.

param
b boolean append flag.

        append = b;
    
public voidsetFile(java.io.File f)
Set the output file.

param
f the output file.


                  
        
        file = f;