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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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,
  48. generating the property names from the
  49. file's element and attribute names.</p>
  50. <pre>
  51. &lt;root-tag myattr="true"&gt;
  52. &lt;inner-tag someattr="val"&gt;Text&lt;/inner-tag&gt;
  53. &lt;a2&gt;&lt;a3&gt;&lt;a4&gt;false&lt;/a4&gt;&lt;/a3&gt;&lt;/a2&gt;
  54. &lt;/root-tag&gt;
  55. </pre>
  56. <p>This is an example xml file.</p>
  57. <pre> root-tag(myattr)=true
  58. root-tag.inner-tag=Text
  59. root-tag.inner-tag(someattr)=val
  60. root-tag.a2.a3.a4=false
  61. </pre>
  62. <p>These are the properties loaded by this task from the previous example file.</p>
  63. <pre> &lt;xmlproperty file="somefile.xml" collapseAttributes="true"/&gt;</pre>
  64. <p>Load contents of somefile.xml as Ant properties collapsing attributes as nodes.</p>
  65. <pre> root-tag.myattr=true
  66. root-tag.inner-tag=Text
  67. root-tag.inner-tag.someatt=val
  68. root-tag.a2.a3.a4=false
  69. </pre>
  70. <p>These are the properties loaded by this task from the previous example file, with
  71. attribute collapsing true.</p>
  72. <hr/>
  73. <p align="center">Copyright &copy; 2002 Apache Software Foundation. All rights
  74. Reserved.</p>
  75. </body>
  76. </html>