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.

loadproperties.html 2.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <html>
  2. <head>
  3. <title>LoadProperties Task</title>
  4. </head>
  5. <body>
  6. <h2><a name="loadproperties">LoadProperties</a></h2>
  7. <h3>Description</h3>
  8. <p>
  9. Load a file's contents as Ant properties. This is equivalent
  10. to &lt;property file|resource=&quot;...&quot;/&gt; except that it
  11. supports nested &lt;filterchain&gt; elements.
  12. </p>
  13. <p>If you want to simulate <a href="property.html">property</a>'s
  14. prefix attribute, please use <a
  15. href="../CoreTypes/filterchain.html#prefixlines">prefixlines</a>
  16. filter.</p>
  17. <h3>Parameters</h3>
  18. <table border="1" cellpadding="2" cellspacing="0">
  19. <tr>
  20. <td valign="top"><b>Attribute</b></td>
  21. <td valign="top"><b>Description</b></td>
  22. <td align="center" valign="top"><b>Required</b></td>
  23. </tr>
  24. <tr>
  25. <td valign="top">srcFile</td>
  26. <td valign="top">source file</td>
  27. <td valign="top" rowspan="2" align="center">One of these</td>
  28. </tr>
  29. <tr>
  30. <td valign="top">resource</td>
  31. <td valign="top">the resource name of the property file</td>
  32. </tr>
  33. <tr>
  34. <td valign="top">encoding</td>
  35. <td valign="top">encoding to use when loading the file</td>
  36. <td align="center" valign="top">No</td>
  37. </tr>
  38. <tr>
  39. <td valign="top">classpath</td>
  40. <td valign="top">the classpath to use when looking up a resource.</td>
  41. <td align="center" valign="top">No</td>
  42. </tr>
  43. <tr>
  44. <td valign="top">classpathref</td>
  45. <td valign="top">the classpath to use when looking up a resource,
  46. given as <a href="../using.html#references">reference</a>
  47. to a &lt;path&gt; defined elsewhere..</td>
  48. <td align="center" valign="top">No</td>
  49. </tr>
  50. </table>
  51. <p>
  52. The LoadProperties task supports nested <a href="../CoreTypes/filterchain.html">
  53. FilterChain</a>s, as well as a nested <code>&lt;classpath&gt;</code>
  54. element for use with the <i>resource</i> attribute.
  55. <h3>Examples</h3>
  56. <pre> &lt;loadproperties srcFile="file.properties"/&gt;
  57. </pre>
  58. Load contents of file.properties as Ant properties.
  59. <pre> &lt;loadproperties srcFile="file.properties"&gt;
  60. &lt;filterchain&gt;
  61. &lt;<a href="../CoreTypes/filterchain.html#linecontains">linecontains</a>&gt;
  62. &lt;contains value=&quot;import.&quot;/&gt;
  63. &lt;/linecontains&gt;
  64. &lt;/filterchain&gt;
  65. &lt;/loadproperties&gt;
  66. </pre>
  67. Read the lines that contain the string &quot;import.&quot;
  68. from the file &quot;file.properties&quot; and load them as
  69. Ant properties.
  70. <hr>
  71. <p align="center">Copyright &copy; 2002-2004 The Apache Software Foundation. All rights
  72. Reserved.</p>
  73. </body>
  74. </html>