How to add a header to xml file

B

Bali Bali

I have a ant build file:

<project name="test" default="run">
<target name="run">
<echo message="hello" />
</target>
</project>

it needs to be changed to:

<?xml version="1.0" encoding="UTF-8" ?>
<!--
***********************
* My license goes here
***********************
-->
<project name="test" default="run">
<target name="run">
<echo message="hello" />
</target>
</project>

After processed, ant complains:
--
D:\googlecode\balionweb\test>ant compile
Buildfile: build.xml

BUILD FAILED
D:\googlecode\balionweb\test\build.xml:12: Content is not allowed in
prolog.

Total time: 0 seconds
--

I have problem in handling new line. Tried "\r", "\n" and "\r\n", but no
luck.
It looks like the first line of xml file is pretty special.

How to do this? Better provide a working code.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top