source: release-kits/wirk3/ant-scripts/tasks/antelope/docs/manual/bk03ch06.html@ 15023

Last change on this file since 15023 was 15023, checked in by oranfry, 16 years ago

did the bulk of the work on wirk3

File size: 3.7 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 6. SwitchTask</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03.html" title="Additional Ant Tasks"><link rel="prev" href="bk03ch05s02.html" title="More Conditions"><link rel="next" href="bk03ch07.html" title="Chapter 7. Try Task"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 6. SwitchTask</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch05s02.html">Prev</a> </td><th width="60%" align="center">Additional Ant Tasks</th><td width="20%" align="right"> <a accesskey="n" href="bk03ch07.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="switch"></a>Chapter 6. SwitchTask</h2></div></div></div>
2<STYLE TYPE="text/css"> <!-- @import url(./style.css); --> </STYLE>
3 <p>
4The "Switch" task works much like the Java "switch" construct. It supports nested "case" elements, which in turn, support nested "break" elements. There is also a "default" case element, so this should be very natural for Java developers to use.
5</p><p>
6</p><div class="table"><a name="id2520537"></a><p class="title"><b>Table 6.1. Switch Task Attributes</b></p><table summary="Switch Task Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>name</td><td>The name of a property whose value will be used for the switch.</td><td>None</td><td>Yes</td></tr></tbody></table></div><p>
7</p><p>
8</p><div class="table"><a name="id2520641"></a><p class="title"><b>Table 6.2. "case" and "default" Attributes</b></p><table summary='"case" and "default" Attributes' border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>value</td><td>The value of of the property used for the switch. If this value equals the property value, then all tasks in this 'case' will be executed.</td><td>None</td><td>Yes</td></tr></tbody></table></div><p>
9</p><p>
10</p><pre class="programlisting">
11
12&lt;property name="foo" value="bar"/&gt;
13&lt;switch name="foo"&gt;
14 &lt;case value="baz"&gt;
15 &lt;echo&gt;Executing case baz&lt;/echo&gt;
16 &lt;break/&gt;
17 &lt;/case&gt;
18 &lt;case value="bar"&gt;
19 &lt;echo&gt;Executing case bar&lt;/echo&gt;
20 &lt;if name="foo" value="bar"&gt;
21 &lt;echo&gt;breaking from the if&lt;/echo&gt;
22 &lt;break/&gt;
23 &lt;/if&gt;
24 &lt;echo&gt;Falling through to case "bat"&lt;/echo&gt;
25 &lt;/case&gt;
26 &lt;case value="bat"&gt;
27 &lt;echo&gt;Executing case bat&lt;/echo&gt;
28 &lt;break/&gt;
29 &lt;/case&gt;
30 &lt;default&gt;
31 &lt;echo&gt;Executing default case&lt;/echo&gt;
32 &lt;break/&gt;
33 &lt;/default&gt;
34&lt;/switch&gt;
35
36</pre><p>
37</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch05s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk03ch07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">More Conditions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Try Task</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.