blob: b8a330bea502521a6526dc0698addf7700aa3c33 [file] [log] [blame]
<html>
<head>
<title>XmlProperty Task</title>
</head>
<body>
<h2><a name="xmlproperty">XmlProperty</a></h2>
<h3>Description</h3>
<p>
Loads property values from a valid xml file.
</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">The XML file to parse.</td>
<td valign="top" align="center">Yes</td>
</tr>
<tr>
<td valign="top">prefix</td>
<td valign="top">The prefix to prepend to each property</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">keepRoot</td>
<td valign="top">If false, it doesn't include the xml root tag as a first
value in the property name.</td>
<td valign="top" align="center">No, default is <i>true</i>.</td>
</tr>
<tr>
<td valign="top">validate</td>
<td valign="top">If true, it enables validation.</td>
<td valign="top" align="center">No, default is <i>false</i>.</td>
</tr>
<tr>
<td valign="top">collapseAttributes</td>
<td valign="top">If true, it treats attributes as nested elements.</td>
<td valign="top" align="center">No, default is <i>false</i>.</td>
</tr>
</table>
<h3>Examples</h3>
<pre> &lt;xmlproperty file="somefile.xml" /&gt;</pre>
<p>Load contents of somefile.xml as Ant properties,
generating the property names from the
file's element and attribute names.</p>
<pre>
&lt;root-tag myattr="true"&gt;
&lt;inner-tag someattr="val"&gt;Text&lt;/inner-tag&gt;
&lt;a2&gt;&lt;a3&gt;&lt;a4&gt;false&lt;/a4&gt;&lt;/a3&gt;&lt;/a2&gt;
&lt;/root-tag&gt;
</pre>
<p>This is an example xml file.</p>
<pre> root-tag(myattr)=true
root-tag.inner-tag=Text
root-tag.inner-tag(someattr)=val
root-tag.a2.a3.a4=false
</pre>
<p>These are the properties loaded by this task from the previous example file.</p>
<pre> &lt;xmlproperty file="somefile.xml" collapseAttributes="true" /&gt;</pre>
<p>Load contents of somefile.xml as Ant properties collapsing attributes as nodes.</p>
<pre> root-tag.myattr=true
root-tag.inner-tag=Text
root-tag.inner-tag.someatt=val
root-tag.a2.a3.a4=false
</pre>
<p>These are the properties loaded by this task from the previous example file, with
attribute collapsing true.</p>
<hr/>
<p align="center">Copyright &copy; 2002 Apache Software Foundation. All rights
Reserved.</p>
</body>
</html>