That's the solution.  Thanks Ryan. 


From: Ryan Davis [mailto:[EMAIL PROTECTED]
Sent: 24 February 2005 14:10
To: Chris Fewtrell; nant-users@lists.sourceforge.net
Subject: RE: [Nant-users] Is there anything already written to do what I want.

I think the <echo> task can do that.

http://nant.sourceforge.net/release/latest/help/tasks/echo.html

 

<echo file="myXML.xml"><![CDATA[<?xml version="1.0" encoding="utf-8"?>

<Hello>

<Contents>World</Contents>

</Hello>]]>
</echo>

 

I think that will work, but I didn't test it.

 

Thanks,
Ryan


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Fewtrell
Sent: Thursday, February 24, 2005 6:17 AM
To: nant-users@lists.sourceforge.net
Subject: [Nant-users] Is there anything already written to do what I want.

 

Hello

 

I simply want to write some text (well actually XML) to a file.  I also think a function/task to append a line text to a file would be handy.

 

Because I am writing out XML to file, it is very tedious to write the code as a function - since I need escape all the < > & " etc characters.  A task would be better suited and have it write the contents of an element to the file - that way I can use a CDATA section to write the XML in plain text.  In Ant, I could have used the concat task like this

 

<concat eol="crlf" outputencoding="UTF-8" destfile="MyXml.xml"><![CDATA[<?xml version="1.0" encoding="utf-8"?>

<Hello>

<Contents>World</Contents>

</Hello>]]></concat>

 

but the NAntContrib concat task seems to be tailored to concatonating file contents only.  Before I write this task (and it is fairly trivial)  can someone tell me if I have missed something blindingly obvious - like an existing task in NAnt / NAntContrib to do what I want.  Or if you have already written such a task and don't mind sharing your work....?

 

Cheers

 

Chris


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System
- after being sent from Granta Design Ltd
______________________________________________________________________


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System
- for inbound mail to Granta Design Ltd.
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System
- after being sent from Granta Design Ltd
______________________________________________________________________

Reply via email to