You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

loadfile.html 2.8 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>LoadFile Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="loadfile">LoadFile</a></h2>
  8. <h3>Description</h3>
  9. <p> Load a text file into a single property. Unless an encoding is specified,
  10. the encoding of the current locale is used. </p>
  11. <h3>Parameters</h3>
  12. <table border="1" cellpadding="2" cellspacing="0">
  13. <tbody>
  14. <tr>
  15. <td valign="top"><b>Attribute</b></td>
  16. <td valign="top"><b>Description</b></td>
  17. <td align="center" valign="top"><b>Required</b></td>
  18. </tr>
  19. <tr>
  20. <td valign="top">srcFile</td>
  21. <td valign="top">source file</td>
  22. <td valign="top" align="center">Yes</td>
  23. </tr>
  24. <tr>
  25. <td valign="top">property</td>
  26. <td valign="top">property to save to</td>
  27. <td valign="top" align="center">Yes</td>
  28. </tr>
  29. <tr>
  30. <td valign="top">encoding</td>
  31. <td valign="top">encoding to use when loading the file</td>
  32. <td align="center" valign="top">No</td>
  33. </tr>
  34. <tr>
  35. <td valign="top">failonerror</td>
  36. <td valign="top">Whether to halt the build on failure</td>
  37. <td align="center" valign="top">No, default "true"</td>
  38. </tr>
  39. </tbody>
  40. </table>
  41. <p>The LoadFile task supports nested <a
  42. href="../CoreTypes/filterchain.html">FilterChain</a>s. </p>
  43. <h3>Examples</h3>
  44. <pre> &lt;loadfile property="message"<br> srcFile="message.txt"/&gt;<br></pre>
  45. Load file message.txt into property "message"; an <tt>&lt;echo&gt;</tt>can
  46. print this.
  47. <pre> &lt;loadfile property="encoded-file"<br> srcFile="loadfile.xml"<br> encoding="ISO-8859-1"/&gt;<br></pre>
  48. Load a file using the latin-1 encoding
  49. <pre> &lt;loadfile<br> property="optional.value"<br> srcFile="optional.txt"<br> failonerror="false"/&gt;<br></pre>
  50. Load a file, don't fail if it is missing (a message is printed, though)
  51. <pre> &lt;loadfile<br> property="mail.recipients"<br> srcFile="recipientlist.txt"&gt;<br> &lt;filterchain&gt;<br> &lt;<a
  52. href="../CoreTypes/filterchain.html#striplinebreaks">striplinebreaks</a>/&gt;<br> &lt;/filterchain&gt;<br> &lt;/loadfile&gt;<br></pre>
  53. Load a property which can be used as a parameter for another task (in this
  54. case mail), merging lines to ensure this happens.
  55. <pre> &lt;loadfile<br> property="system.configuration.xml"<br> srcFile="configuration.xml"&gt;<br> &lt;filterchain&gt;<br> &lt;<a
  56. href="../CoreTypes/filterchain.html#expandproperties">expandproperties</a>/&gt;<br> &lt;/filterchain&gt;<br> &lt;/loadfile&gt;<br></pre>
  57. Load an XML file into a property, expanding all properties declared in the
  58. file in the process.
  59. <hr>
  60. <p align="center">Copyright &copy; 2001-2002 Apache Software Foundation.
  61. All rights Reserved.</p>
  62. <br>
  63. </body>
  64. </html>