diff --git a/docs/manual/CoreTasks/conditions.html b/docs/manual/CoreTasks/conditions.html index 86248d06b..671941ac3 100644 --- a/docs/manual/CoreTasks/conditions.html +++ b/docs/manual/CoreTasks/conditions.html @@ -311,10 +311,10 @@ that is "true","yes", or "on"
- <istrue value="${someproperty}"/> - <istrue value="false"/> -+
+<istrue value="${someproperty}"/> +<istrue value="false"/> +
Tests whether a string is not true, the negation of <istrue> @@ -331,10 +331,10 @@ that is "true","yes", or "on"
- <isfalse value="${someproperty}"/> - <isfalse value="false"/> -+
+<isfalse value="${someproperty}"/> +<isfalse value="false"/> +
Example usage:
--+- <isfileselected file="a.xml"> - <date datetime="06/28/2000 2:02 pm" when="equal"/> - </isfileselected> -
+<isfileselected file="a.xml"> + <date datetime="06/28/2000 2:02 pm" when="equal"/> +</isfileselected> +
Test whether a given type is defined, and that @@ -461,11 +460,10 @@ tasks, datatypes, scriptdefs, macrodefs and presetdefs.
Example usages:
--+- <typefound name="junit"/> - <typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/> -
+<typefound name="junit"/> +<typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/> +
Example:
-- <scriptcondition language="javascript" - value="true"> - self.setValue(false); - </scriptcondition> -+
Sets the default value of the condition to true, then in the script, sets the value to false. This condition always evaluates to "false" @@ -551,27 +549,26 @@ attempting to set the appropriate property/feature/ -+<scriptcondition language="javascript" + value="true"> + self.setValue(false); +</scriptcondition> +
+Check for namespace support. All SAX2 parsers should have this. -<parsersupports feature="http://xml.org/sax/features/namespaces"/> -+
+Check for XML Schema support. -<or> <parsersupports feature="http://apache.org/xml/features/validation/schema"/> <parsersupports feature="http://java.sun.com/xml/jaxp/properties/schemaSource"/> </or> -+
- +Check for Xerces-specific definition of the location of the no namespace schema. @@ -628,21 +625,21 @@ This condition was added in Apache Ant 1.7. -<parsersupports property="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" value="document.xsd"/> -+
+<condition property="offline"> <isreachable url="http://ibiblio.org/maven/" /> </condition> -+
Probe for the maven repository being reachable.
-+<condition property="offline"> <isreachable host="ibiblio.org" timeout="10" /> </condition> -+
Probe for the maven repository being reachable using the hostname, ten second timeout.. @@ -654,14 +651,14 @@ Probe for the maven repository being reachable using the hostname, ten second ti Since Ant 1.6.3
--<length string=" foo " trim="true" length="3" /> -+
+<length string=" foo " trim="true" length="3" /> +
Verify a string is of a certain length.
-+<length file="foo" when="greater" length="0" /> -+
Verify that file foo is not empty.
+<resourcecount refid="myresourcecollection" when="greater" length="0" /> -+
Verify that a resource collection is not empty.
- <hasmethod classname="java.util.ArrayList" method="trimToSize" /> -+
+<hasmethod classname="java.util.ArrayList" method="trimToSize" /> +
Looks for the method trimToSize in the ArrayList class.
++ Test if the specified string matches the specified regular + expression pattern. + Since Ant 1.7
+Attribute | +Description | +Required | +
string | +The string to test. | +Yes | +
match | +The regular expression pattern used to test. | +Yes, unless there is a nested
+ <regexp> element. |
+
casesensitive | +Perform a case sensitive match. Default is + true. | +No | +
multiline | ++ Perform a multi line match. + Default is false. | +No | +
singleline | ++ This allows '.' to match new lines. + SingleLine is not to be confused with multiline, SingleLine is a perl + regex term, it corresponds to dotall in java regex. + Default is false. | +No | +
+ There is also an optional <regexp> element, which can be used to specify + a regular expression instead of the "pattern" attribute. + See Regexp Type for the description + of the nested element regexp and of + the choice of regular expression implementation. +
++ An example: +
+++<condition propery="legal-password"> + <matches pattern="[1-9]" string="${user-input}"/> +</condition> +<fail message="Your password should at least contain one number" + unless="legal-password"/> +
+ The following example sets the property "ok" if + the property "input" is three characters long, starting + with 'a' and ending with 'b'. +
+++<condition property="ok"> + <matches string="${input}" pattern="^a.b$"/> +</condition> +
+ The following defines a reference regular expression for + matching dates and then uses antunit to check if the + property "today" is in the correct format: +
+++<regexp id="date.pattern" pattern="^[0123]\d-[01]\d-[12]\d\d\d$"/> + +<au:assertTrue xmlns:au="antlib:org.apache.ant.antunit"> + <matches string="${today}"> + <regexp refid="date.pattern"/> + </matches> +</au:assertTrue> +
+ The following example shows the use of the singleline and the casesensitive + flags. +
++<au:assertTrue> + <matches string="AB${line.separator}C" pattern="^ab.*C$" + casesensitive="false" + singleline="true"/> +</au:assertTrue> +<au:assertFalse> + <matches string="AB${line.separator}C" pattern="^ab.*C$" + casesensitive="false" + singleline="false"/> +</au:assertFalse> +