EchoXML (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs, class: EchoXML

# Class EchoXML

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.util.XMLFragment
org.apache.tools.ant.taskdefs.EchoXML

All Implemented Interfaces:
  `Cloneable, DynamicElementNS`

public class EchoXML extends XMLFragment
Echo XML. Known limitations:

1. Processing Instructions get ignored
2. Encoding is always UTF-8

Since:
  Ant 1.7

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `EchoXML.NamespacePolicy`

  ### Nested classes/interfaces inherited from class XMLFragment

  `XMLFragment.Child`
  Modifier and Type
  Class
  Description
  `class`
  `XMLFragment.Child`
  An object to handle (recursively) nested elements.

- ## Field Summary

  ### Fields inherited from class ProjectComponent

  `description, location, project`
  Modifier and Type
  Field
  Description
  `protected String`
  `description`
  Deprecated.
  since 1.6.x.
  `protected Location`
  `location`
  Deprecated.
  since 1.6.x.
  `protected Project`
  `project`
  Deprecated.
  since 1.6.x.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `EchoXML()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute()`
  Execute the task.
  `void`
  `setAppend(boolean b)`
  Set whether to append the output file.
  `void`
  `setFile(File f)`
  Set the output file.
  `void`
  `setNamespacePolicy(EchoXML.NamespacePolicy n)`
  Set the namespace policy for the xml file

  ### Methods inherited from class XMLFragment

  `addText, createDynamicElement, getFragment`
  Modifier and Type
  Method
  Description
  `void`
  `addText(String s)`
  Add nested text, expanding properties as we go
  `Object`
  `createDynamicElement(String uri, String name, String qName)`
  Creates a nested element.
  `DocumentFragment`
  `getFragment()`

  ### Methods inherited from class ProjectComponent

  `clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject`
  Modifier and Type
  Method
  Description
  `Object`
  `clone()`
  `String`
  `getDescription()`
  Returns the description of the current action.
  `Location`
  `getLocation()`
  Returns the file/location where this task was defined.
  `Project`
  `getProject()`
  Returns the project to which this component belongs.
  `void`
  `log(String msg)`
  Logs a message with the default (INFO) priority.
  `void`
  `log(String msg, int msgLevel)`
  Logs a message with the given priority.
  `void`
  `setDescription(String desc)`
  Sets a description of the current action.
  `void`
  `setLocation(Location location)`
  Sets the file/location where this task was defined.
  `void`
  `setProject(Project project)`
  Sets the project object of this component.

  ### Methods inherited from class Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### EchoXML

    public EchoXML()

- ## Method Details

  - ### setFile

    public void setFile(File f)
    Set the output file.
    Parameters:
      `f` - the output file.

  - ### setNamespacePolicy

    public void setNamespacePolicy(EchoXML.NamespacePolicy n)
    Set the namespace policy for the xml file
    Parameters:
      `n` - namespace policy: "ignore", "elementsOnly", or "all"
    See Also:
      - `DOMElementWriter.XmlNamespacePolicy`

  - ### setAppend

    public void setAppend(boolean b)
    Set whether to append the output file.
    Parameters:
      `b` - boolean append flag.

  - ### execute

    public void execute()
    Execute the task.