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.6 KiB

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