source: other-projects/trunk/realistic-books/packages/AntInstaller/web/manual1.7.0/manual/CoreTasks/loadfile.html@ 19253

Last change on this file since 19253 was 19253, checked in by davidb, 15 years ago

Establishing a source code repository for Veronica's Realistic Book's software

File size: 4.0 KB
Line 
1<!--
2 Licensed to the Apache Software Foundation (ASF) under one or more
3 contributor license agreements. See the NOTICE file distributed with
4 this work for additional information regarding copyright ownership.
5 The ASF licenses this file to You under the Apache License, Version 2.0
6 (the "License"); you may not use this file except in compliance with
7 the License. You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<html>
18<head>
19<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
20<title>LoadFile Task</title>
21</head>
22
23<body>
24
25
26<h2><a name="loadfile">LoadFile</a></h2>
27<h3>Description</h3>
28<p>
29Specialization of <a href="loadresource.html">loadresource</a> that
30works on files exclusively and provides a srcFile attribute for
31convenience. Unless an encoding is specified, the encoding of the
32current locale is used.
33</p>
34
35<h3>Parameters</h3>
36<table border="1" cellpadding="2" cellspacing="0">
37 <tr>
38 <td valign="top"><b>Attribute</b></td>
39 <td valign="top"><b>Description</b></td>
40 <td align="center" valign="top"><b>Required</b></td>
41 </tr>
42 <tr>
43 <td valign="top">srcFile</td>
44 <td valign="top">source file</td>
45 <td valign="top" align="center">Yes</td>
46 </tr>
47 <tr>
48 <td valign="top">property</td>
49 <td valign="top">property to save to</td>
50 <td valign="top" align="center">Yes</td>
51 </tr>
52 <tr>
53 <td valign="top">encoding</td>
54 <td valign="top">encoding to use when loading the file</td>
55 <td align="center" valign="top">No</td>
56 </tr>
57 <tr>
58 <td valign="top">failonerror</td>
59 <td valign="top">Whether to halt the build on failure</td>
60 <td align="center" valign="top">No, default "true"</td>
61 </tr>
62 <tr>
63 <td valign="top">quiet</td>
64 <td valign="top">Do not display a diagnostic message (unless Ant has been
65 invoked with the <code>-verbose</code> or <code>-debug</code>
66 switches) or modify the exit status to reflect an error. Setting this to
67 "true" implies setting failonerror to "false".
68 <em>Since Ant 1.7.0.</em>
69 </td>
70 <td align="center" valign="top">No, default "false"</td>
71 </tr>
72
73</table>
74<p>
75The LoadFile task supports nested <a href="../CoreTypes/filterchain.html">
76FilterChain</a>s.
77
78<h3>Examples</h3>
79<pre> &lt;loadfile property="message"
80 srcFile="message.txt"/&gt;
81</pre>
82Load file message.txt into property "message"; an <tt>&lt;echo&gt;</tt>
83can print this. This is identical to
84<pre> &lt;loadresource property="message"&gt;
85 &lt;file file="message.txt"/&gt;
86 &lt;/loadresource&gt;
87</pre>
88</p>
89
90<pre> &lt;loadfile property="encoded-file"
91 srcFile="loadfile.xml"
92 encoding="ISO-8859-1"/&gt;
93</pre>
94Load a file using the latin-1 encoding
95
96<pre> &lt;loadfile
97 property="optional.value"
98 srcFile="optional.txt"
99 failonerror="false"/&gt;
100</pre>
101Load a file, don't fail if it is missing (a message is printed, though)
102
103<pre> &lt;loadfile
104 property="mail.recipients"
105 srcFile="recipientlist.txt"&gt;
106 &lt;filterchain&gt;
107 &lt;<a href="../CoreTypes/filterchain.html#striplinebreaks">striplinebreaks</a>/&gt;
108 &lt;/filterchain&gt;
109 &lt;/loadfile&gt;
110</pre>
111Load a property which can be used as a parameter for another task (in this case mail),
112merging lines to ensure this happens.
113
114<pre> &lt;loadfile
115 property="system.configuration.xml"
116 srcFile="configuration.xml"&gt;
117 &lt;filterchain&gt;
118 &lt;<a href="../CoreTypes/filterchain.html#expandproperties">expandproperties</a>/&gt;
119 &lt;/filterchain&gt;
120 &lt;/loadfile&gt;
121</pre>
122Load an XML file into a property, expanding all properties declared
123in the file in the process.
124
125
126
127
128</body>
129</html>
130
Note: See TracBrowser for help on using the repository browser.