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.

xmlproperty.html 2.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <html>
  2. <head>
  3. <title>XmlProperty Task</title>
  4. </head>
  5. <body>
  6. <h2><a name="xmlproperty">XmlProperty</a></h2>
  7. <h3>Description</h3>
  8. <p>
  9. Loads property values from a valid xml file.
  10. </p>
  11. <h3>Parameters</h3>
  12. <table border="1" cellpadding="2" cellspacing="0">
  13. <tr>
  14. <td valign="top"><b>Attribute</b></td>
  15. <td valign="top"><b>Description</b></td>
  16. <td align="center" valign="top"><b>Required</b></td>
  17. </tr>
  18. <tr>
  19. <td valign="top">file</td>
  20. <td valign="top">The XML file to parse.</td>
  21. <td valign="top" align="center">Yes</td>
  22. </tr>
  23. <tr>
  24. <td valign="top">prefix</td>
  25. <td valign="top">The prefix to prepend to each property</td>
  26. <td valign="top" align="center">No</td>
  27. </tr>
  28. <tr>
  29. <td valign="top">keepRoot</td>
  30. <td valign="top">If false, it doesn't include the xml root tag as a first
  31. value in the property name.</td>
  32. <td valign="top" align="center">No, default is <i>true</i>.</td>
  33. </tr>
  34. <tr>
  35. <td valign="top">validate</td>
  36. <td valign="top">If true, it enables validation.</td>
  37. <td valign="top" align="center">No, default is <i>false</i>.</td>
  38. </tr>
  39. <tr>
  40. <td valign="top">collapseAttributes</td>
  41. <td valign="top">If true, it treats attributes as nested elements.</td>
  42. <td valign="top" align="center">No, default is <i>false</i>.</td>
  43. </tr>
  44. </table>
  45. <h3>Examples</h3>
  46. <pre> &lt;xmlproperty file="somefile.xml" /&gt;</pre>
  47. <p>Load contents of somefile.xml as Ant properties.</p>
  48. <pre>
  49. &lt;root-tag myattr="true"&gt;
  50. &lt;inner-tag someattr="val"&gt;Text&lt;/inner-tag&gt;
  51. &lt;a2&gt;&lt;a3&gt;&lt;a4&gt;false&lt;/a4&gt;&lt;/a3&gt;&lt;/a2&gt;
  52. &lt;/root-tag&gt;
  53. </pre>
  54. <p>This is an example xml file.</p>
  55. <pre> root-tag(myattr)=true
  56. root-tag.inner-tag=Text
  57. root-tag.inner-tag(someattr)=val
  58. root-tag.a2.a3.a4=false
  59. </pre>
  60. <p>These are the properties loaded by this task from the previous example file.</p>
  61. <pre> &lt;xmlproperty file="somefile.xml" collapseAttributes="true" /&gt;</pre>
  62. <p>Load contents of somefile.xml as Ant properties collapsing attributes as nodes.</p>
  63. <pre> root-tag.myattr=true
  64. root-tag.inner-tag=Text
  65. root-tag.inner-tag.someatt=val
  66. root-tag.a2.a3.a4=false
  67. </pre>
  68. <p>These are the properties loaded by this task from the previous example file, with
  69. attribute collapsing true.</p>
  70. <hr/>
  71. <p align="center">Copyright &copy; 2002 Apache Software Foundation. All rights
  72. Reserved.</p>
  73. </body>
  74. </html>