source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/docs/manual/CoreTasks/loadfile.html@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 2.7 KB
Line 
1<html>
2<head>
3<title>LoadFile Task</title>
4<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
5</head>
6
7<body>
8
9
10<h2><a name="loadfile">LoadFile</a></h2>
11<h3>Description</h3>
12<p>
13 Load a text file into a single property. Unless an encoding is specified,
14 the encoding of the current locale is used.
15
16</p>
17
18<h3>Parameters</h3>
19<table border="1" cellpadding="2" cellspacing="0">
20 <tr>
21 <td valign="top"><b>Attribute</b></td>
22 <td valign="top"><b>Description</b></td>
23 <td align="center" valign="top"><b>Required</b></td>
24 </tr>
25 <tr>
26 <td valign="top">srcFile</td>
27 <td valign="top">source file</td>
28 <td valign="top" align="center">Yes</td>
29 </tr>
30 <tr>
31 <td valign="top">property</td>
32 <td valign="top">property to save to</td>
33 <td valign="top" align="center">Yes</td>
34 </tr>
35 <tr>
36 <td valign="top">encoding</td>
37 <td valign="top">encoding to use when loading the file</td>
38 <td align="center" valign="top">No</td>
39 </tr>
40 <tr>
41 <td valign="top">failonerror</td>
42 <td valign="top">Whether to halt the build on failure</td>
43 <td align="center" valign="top">No, default "true"</td>
44 </tr>
45</table>
46<p>
47The LoadFile task supports nested <a href="../CoreTypes/filterchain.html">
48FilterChain</a>s.
49
50<h3>Examples</h3>
51<pre> &lt;loadfile property="message"
52 srcFile="message.txt"/&gt;
53</pre>
54Load file message.txt into property "message"; an <tt>&lt;echo&gt;</tt>
55can print this.
56
57<pre> &lt;loadfile property="encoded-file"
58 srcFile="loadfile.xml"
59 encoding="ISO-8859-1"/&gt;
60</pre>
61Load a file using the latin-1 encoding
62
63<pre> &lt;loadfile
64 property="optional.value"
65 srcFile="optional.txt"
66 failonerror="false"/&gt;
67</pre>
68Load a file, don't fail if it is missing (a message is printed, though)
69
70<pre> &lt;loadfile
71 property="mail.recipients"
72 srcFile="recipientlist.txt"&gt;
73 &lt;filterchain&gt;
74 &lt;<a href="../CoreTypes/filterchain.html#striplinebreaks">striplinebreaks</a>/&gt;
75 &lt;/filterchain&gt;
76 &lt;/loadfile&gt;
77</pre>
78Load a property which can be used as a parameter for another task (in this case mail),
79merging lines to ensure this happens.
80
81<pre> &lt;loadfile
82 property="system.configuration.xml"
83 srcFile="configuration.xml"&gt;
84 &lt;filterchain&gt;
85 &lt;<a href="../CoreTypes/filterchain.html#expandproperties">expandproperties</a>/&gt;
86 &lt;/filterchain&gt;
87 &lt;/loadfile&gt;
88</pre>
89Load an XML file into a property, expanding all properties declared
90in the file in the process.
91
92
93<hr>
94
95<p align="center">Copyright &copy; 2001-2002,2004 The Apache Software Foundation. All rights
96Reserved.</p>
97
98</body>
99</html>
100
Note: See TracBrowser for help on using the repository browser.