title: How to use Ant echo task to append to file when what I'm adding contains CDATA?
body: <p>I need to create an Ant task to add lines at the start and at the end of .txt files. </p>
  
  <p>I need to add this to the start of each file:</p>
  
  <pre><code>&lt;ac:structured-macro ac:name="html"&gt;&lt;ac:plain-text-body&gt;&lt;![CDATA[
  </code></pre>
  
  <p>And I need to add this to the end of each file:</p>
  
  <pre><code>&gt;&lt;/ac:plain-text-body&gt;&lt;/ac:structured-macro&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;ac:structured-macro ac:name="anchor"&gt;&lt;ac:parameter ac:name=""&gt;_GoBack&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
  </code></pre>
  
  <p>I understand that I can probably use echo to append these to the files. However it seems that ![CDATA is how you call out the content to be added as code rather than executing any part of it in the Ant script. The problem is that the piece I need to add <em>contains</em> ![CDATA. </p>
  
  <p>That is, I need a file at the end with the two lines above added to it verbatim. Can someone explain how to do this, if not echo, is there some other way?</p>
  
  <p>I'm new to Ant but I've created build files with some other Ant tasks this week that work perfectly. </p>
  
  <p>Thanks</p>
  
  <p><strong>Update:</strong> To elaborate, here's a simplified example of what I need as the result:</p>
  
  <pre><code>&lt;ac:structured-macro ac:name="html"&gt;&lt;ac:plain-text-body&gt;&lt;![CDATA[
  
  &lt;!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html&gt;
  
  &lt;/html&gt;
  
  ]]&gt;&lt;/ac:plain-text-body&gt;&lt;/ac:structured-macro&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;ac:structured-macro ac:name="anchor"&gt;&lt;ac:parameter ac:name=""&gt;_GoBack&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
  </code></pre>
  
  <p>What I'm creating are text files that create pages in Confluence. The opening and closing sections create an "HTML Include Macro" in Confluence that allows me to just use HTML, instead of the completely different system that Confluence uses. Between <code>&lt;html&gt;</code> and <code>&lt;/htmL&gt;</code> in the above example is where all my normal HTML page markup lives. </p>
  
  <p>If what I have here were in a .txt file put in a Confluence folder, it would create a Confluence page with a box, inside of which you can use HTML.  </p>
  
  <p>What my XML publication (from Oxygen) outputs is the part that starts with <code>&lt;!DOCTYPE html</code> and ends with <code>&lt;/html&gt;</code></p>