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.

loadresource.html 2.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  18. <title>LoadResource Task</title>
  19. </head>
  20. <body>
  21. <h2><a name="loadresource">LoadResource</a></h2>
  22. <p><em>Since Ant 1.7</em></p>
  23. <h3>Description</h3>
  24. <p>
  25. Load a text resource into a single property. Unless an encoding is
  26. specified, the encoding of the current locale is used. Resources to
  27. load are specified as nested <a
  28. href="../CoreTypes/resources.html">resource</a> elements or single
  29. element resource collections. If the resource content is empty (maybe after
  30. processing a filterchain) the property is not set.
  31. </p>
  32. <h3>Parameters</h3>
  33. <table border="1" cellpadding="2" cellspacing="0">
  34. <tr>
  35. <td valign="top"><b>Attribute</b></td>
  36. <td valign="top"><b>Description</b></td>
  37. <td align="center" valign="top"><b>Required</b></td>
  38. </tr>
  39. <tr>
  40. <td valign="top">property</td>
  41. <td valign="top">property to save to</td>
  42. <td valign="top" align="center">Yes</td>
  43. </tr>
  44. <tr>
  45. <td valign="top">encoding</td>
  46. <td valign="top">encoding to use when loading the resource</td>
  47. <td align="center" valign="top">No</td>
  48. </tr>
  49. <tr>
  50. <td valign="top">failonerror</td>
  51. <td valign="top">Whether to halt the build on failure</td>
  52. <td align="center" valign="top">No, default "true"</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">quiet</td>
  56. <td valign="top">Do not display a diagnostic message (unless Ant has been
  57. invoked with the <code>-verbose</code> or <code>-debug</code>
  58. switches) or modify the exit status to reflect an error. Setting this to
  59. "true" implies setting failonerror to "false".
  60. </td>
  61. <td align="center" valign="top">No, default "false"</td>
  62. </tr>
  63. </table>
  64. <p>
  65. The LoadResource task supports nested <a href="../CoreTypes/filterchain.html">
  66. FilterChain</a>s.
  67. <h3>Examples</h3>
  68. <pre>
  69. &lt;loadresource property="homepage"&gt;
  70. &lt;url url="http://ant.apache.org/index.html"/&gt;
  71. &lt;/loadresource&gt;
  72. </pre>
  73. Load the entry point of Ant's homepage into property "homepage"; an
  74. <tt>&lt;echo&gt;</tt> can print this.
  75. <p>For more examples see the <a href="loadfile.html">loadfile</a> task.</p>
  76. </body>
  77. </html>