mbenson 2005/04/08 12:14:34 Modified: docs/manual/CoreTypes filterchain.html Log: Lower-case HTML tags Revision Changes Path 1.25 +604 -604 ant/docs/manual/CoreTypes/filterchain.html Index: filterchain.html =================================================================== RCS file: /home/cvs/ant/docs/manual/CoreTypes/filterchain.html,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- filterchain.html 7 Mar 2005 18:18:27 -0000 1.24 +++ filterchain.html 8 Apr 2005 19:14:34 -0000 1.25 @@ -1,28 +1,28 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> -<HTML> -<HEAD> +<html> +<head> <link rel="stylesheet" type="text/css" href="../stylesheets/style.css"/> -<title>FilterChains and FilterReaders</TITLE> -</HEAD> +<title>FilterChains and FilterReaders</title> +</head> -<BODY> +<body> -<H2>FilterChains and FilterReaders</H2> +<h2>FilterChains and FilterReaders</h2> Look at Unix pipes - they offer you so much flexibility - say you wanted to copy just those lines that contained the string blee from the first 10 lines of a file 'foo' -to a file 'bar' - you would do something like<P> +to a file 'bar' - you would do something like<p> <code> cat foo|head -n10|grep blee > bar -</code><P> +</code><p> Ant was not flexible enough. There was no way for the <code><copy></code> task to do something similar. If you wanted the <code><copy></code> task to get the first 10 lines, you would have -had to create special attributes:<P> +had to create special attributes:<p> <code> <copy file="foo" tofile="bar" head="10" contains="blee"/> -</code><P> +</code><p> The obvious problem thus surfaced: Ant tasks would not be able to accommodate such data transformation attributes as they would be endless. The task would also not know in which order these @@ -31,7 +31,7 @@ What Ant tasks needed was a mechanism to allow pluggable filter (data transformer) chains. Ant would provide a few filters for which there have been repeated requests. Users with special filtering needs -would be able to easily write their own and plug them in.<P> +would be able to easily write their own and plug them in.<p> The solution was to refactor data transformation oriented tasks to support FilterChains. A FilterChain is a group of @@ -39,9 +39,9 @@ by just extending the java.io.FilterReader class. Such custom FilterReaders can be easily plugged in as nested elements of <code><filterchain></code> by using <code><filterreader></code> elements. -<P> +<p> Example: -<BLOCKQUOTE><PRE> +<blockquote><pre> <copy file="${src.file}" tofile="${dest.file}"> <filterchain> <filterreader classname="your.extension.of.java.io.FilterReader"> @@ -56,21 +56,21 @@ </filterreader> </filterchain> </copy> -</PRE></BLOCKQUOTE> +</pre></blockquote> Ant provides some built-in filter readers. These filter readers can also be declared using a syntax similar to the above syntax. -However, they can be declared using some simpler syntax also.<P> +However, they can be declared using some simpler syntax also.<p> Example: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.head}"> <filterchain> <headfilter lines="15"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> is equivalent to: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.head}"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.HeadFilter"> @@ -78,36 +78,36 @@ </filterreader> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> -The following built-in tasks support nested <code><filterchain></code> elements.<BR> -<a href="../CoreTasks/concat.html">Concat</a>,<BR> -<a href="../CoreTasks/copy.html">Copy</a>,<BR> -<a href="../CoreTasks/loadfile.html">LoadFile</a>,<BR> -<a href="../CoreTasks/loadproperties.html">LoadProperties</a>,<BR> -<a href="../CoreTasks/move.html">Move</a><BR><BR> +The following built-in tasks support nested <code><filterchain></code> elements.<br> +<a href="../CoreTasks/concat.html">Concat</a>,<br> +<a href="../CoreTasks/copy.html">Copy</a>,<br> +<a href="../CoreTasks/loadfile.html">LoadFile</a>,<br> +<a href="../CoreTasks/loadproperties.html">LoadProperties</a>,<br> +<a href="../CoreTasks/move.html">Move</a><br><br> A FilterChain is formed by defining zero or more of the following -nested elements.<BR> -<a href="#filterreader">FilterReader</a><BR> -<a href="#classconstants">ClassConstants</a><BR> -<a href="#escapeunicode">EscapeUnicode</a><BR> -<a href="#expandproperties">ExpandProperties</a><BR> -<a href="#headfilter">HeadFilter</a><BR> -<a href="#linecontains">LineContains</a><BR> -<a href="#linecontainsregexp">LineContainsRegExp</a><BR> -<a href="#prefixlines">PrefixLines</a><BR> -<a href="#replacetokens">ReplaceTokens</a><BR> -<a href="#stripjavacomments">StripJavaComments</a><BR> -<a href="#striplinebreaks">StripLineBreaks</a><BR> -<a href="#striplinecomments">StripLineComments</a><BR> -<a href="#tabstospaces">TabsToSpaces</a><BR> -<a href="#tailfilter">TailFilter</a><BR> -<a href="#deletecharacters">DeleteCharacters</a><BR> -<a href="#concatfilter">ConcatFilter</a><BR> -<a href="#tokenfilter">TokenFilter</a><BR> +nested elements.<br> +<a href="#filterreader">FilterReader</a><br> +<a href="#classconstants">ClassConstants</a><br> +<a href="#escapeunicode">EscapeUnicode</a><br> +<a href="#expandproperties">ExpandProperties</a><br> +<a href="#headfilter">HeadFilter</a><br> +<a href="#linecontains">LineContains</a><br> +<a href="#linecontainsregexp">LineContainsRegExp</a><br> +<a href="#prefixlines">PrefixLines</a><br> +<a href="#replacetokens">ReplaceTokens</a><br> +<a href="#stripjavacomments">StripJavaComments</a><br> +<a href="#striplinebreaks">StripLineBreaks</a><br> +<a href="#striplinecomments">StripLineComments</a><br> +<a href="#tabstospaces">TabsToSpaces</a><br> +<a href="#tailfilter">TailFilter</a><br> +<a href="#deletecharacters">DeleteCharacters</a><br> +<a href="#concatfilter">ConcatFilter</a><br> +<a href="#tokenfilter">TokenFilter</a><br> -<H3><a name="filterreader">FilterReader</a></H3> +<h3><a name="filterreader">FilterReader</a></h3> The filterreader element is the generic way to define a filter. User defined filter elements are @@ -121,91 +121,91 @@ needs to be parameterized, it must implement org.apache.tools.type.Parameterizable. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>classname</TD> - <TD vAlign=top>The class name of the filter reader.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> -</TABLE> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>classname</td> + <td vAlign=top>The class name of the filter reader.</td> + <td vAlign=top align="center">Yes</td> + </tr> +</table> -<P> -<H4>Nested Elements:</H4> +<p> +<h4>Nested Elements:</h4> <code><filterreader></code> supports <code><classpath></code> and <code><param></code> as nested elements. Each <code><param></code> element may take in the following attributes - name, type and value. -<P> +<p> The following FilterReaders are supplied with the default distribution. -<H3><a name="classconstants">ClassConstants</a></H3> -<P> +<h3><a name="classconstants">ClassConstants</a></h3> +<p> This filters basic constants defined in a Java Class, and outputs them in lines composed of the format name=value -<P> -<H4>Example:</H4> +<p> +<h4>Example:</h4> This loads the basic constants defined in a Java class as Ant properties. -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadproperties srcfile="foo.class"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.ClassConstants"/> </filterchain> </loadproperties> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadproperties srcfile="foo.class"> <filterchain> <classconstants/> </filterchain> </loadproperties> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="escapeunicode">EscapeUnicode</a></H3> -<P> +<h3><a name="escapeunicode">EscapeUnicode</a></h3> +<p> This filter converts its input by changing all non US-ASCII characters into their equivalent unicode escape backslash u plus 4 digits.</p> -<P><em>since Ant 1.6</em></p> +<p><em>since Ant 1.6</em></p> -<H4>Example:</H4> +<h4>Example:</h4> This loads the basic constants defined in a Java class as Ant properties. -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadproperties srcfile="non_ascii_property.properties"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.EscapeUnicode"/> </filterchain> </loadproperties> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadproperties srcfile="non_ascii_property.properties"> <filterchain> <escapeunicode/> </filterchain> </loadproperties> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="expandproperties">ExpandProperties</a></H3> -<P> +<h3><a name="expandproperties">ExpandProperties</a></h3> +<p> If the data contains data that represents Ant properties (of the form ${...}), that is substituted with the property's actual value. -<P> -<H4>Example:</H4> +<p> +<h4>Example:</h4> This results in the property modifiedmessage holding the value "All these moments will be lost in time, like teardrops in the rain" -<BLOCKQUOTE><PRE> +<blockquote><pre> <echo message="All these moments will be lost in time, like teardrops in the ${weather}" file="loadfile1.tmp" @@ -216,10 +216,10 @@ <filterreader classname="org.apache.tools.ant.filters.ExpandProperties"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <echo message="All these moments will be lost in time, like teardrops in the ${weather}" file="loadfile1.tmp" @@ -230,37 +230,37 @@ <expandproperties/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="headfilter">HeadFilter</a></H3> +<h3><a name="headfilter">HeadFilter</a></h3> This filter reads the first few lines from the data supplied to it. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Name</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>lines</TD> - <TD vAlign=top align="center">Number of lines to be read. - Defaults to "10" <BR> A negative value means that all lines are - passed (useful with <I>skip</I>)</TD> - <TD vAlign=top align="center">No</TD> - </TR> - <TR> - <TD vAlign=top>skip</TD> - <TD vAlign=top align="center">Number of lines to be skipped (from the beginning). - Defaults to "0"</TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> -<P> -<H4>Example:</H4> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Name</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>lines</td> + <td vAlign=top align="center">Number of lines to be read. + Defaults to "10" <br> A negative value means that all lines are + passed (useful with <i>skip</i>)</td> + <td vAlign=top align="center">No</td> + </tr> + <tr> + <td vAlign=top>skip</td> + <td vAlign=top align="center">Number of lines to be skipped (from the beginning). + Defaults to "0"</td> + <td vAlign=top align="center">No</td> + </tr> +</table> +<p> +<h4>Example:</h4> This stores the first 15 lines of the supplied data in the property ${src.file.head} -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.head}"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.HeadFilter"> @@ -268,162 +268,162 @@ </filterreader> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.head}"> <filterchain> <headfilter lines="15"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> This stores the first 15 lines, skipping the first 2 lines, of the supplied data in the property ${src.file.head}. (Means: lines 3-17) -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.head}"> <filterchain> <headfilter lines="15" skip="2"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> -See the testcases for more examples (<I>src\etc\testcases\filters\head-tail.xml</I> in the +See the testcases for more examples (<i>src\etc\testcases\filters\head-tail.xml</i> in the source distribution). -<H3><a name="linecontains">LineContains</a></H3> +<h3><a name="linecontains">LineContains</a></h3> This filter includes only those lines that contain all the user-specified strings. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Type</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>contains</TD> - <TD vAlign=top align="center">Substring to be searched for.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> -</TABLE> -<P> -<H4>Example:</H4> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Type</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>contains</td> + <td vAlign=top align="center">Substring to be searched for.</td> + <td vAlign=top align="center">Yes</td> + </tr> +</table> +<p> +<h4>Example:</h4> This will include only those lines that contain <code>foo</code> and <code>bar</code>. -<BLOCKQUOTE><PRE> +<blockquote><pre> <filterreader classname="org.apache.tools.ant.filters.LineContains"> <param type="contains" value="foo"/> <param type="contains" value="bar"/> </filterreader> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <linecontains> <contains value="foo"/> <contains value="bar"/> </linecontains> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="linecontainsregexp">LineContainsRegExp</a></H3> +<h3><a name="linecontainsregexp">LineContainsRegExp</a></h3> Filter which includes only those lines that contain the user-specified regular expression matching strings. See <a href="../CoreTypes/regexp.html">Regexp Type</a> for the description of the nested element regexp and of the choice of regular expression implementation. -<H4>Example:</H4> +<h4>Example:</h4> This will fetch all those lines that contain the pattern <code>foo</code> -<BLOCKQUOTE><PRE> +<blockquote><pre> <filterreader classname="org.apache.tools.ant.filters.LineContainsRegExp"> <param type="regexp" value="foo*"/> </filterreader> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <linecontainsregexp> <regexp pattern="foo*"/> </linecontainsregexp> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="prefixlines">PrefixLines</a></H3> +<h3><a name="prefixlines">PrefixLines</a></h3> Attaches a prefix to every line. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Name</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>prefix</TD> - <TD vAlign=top align="center">Prefix to be attached to lines.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> -</TABLE> -<P> -<H4>Example:</H4> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Name</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>prefix</td> + <td vAlign=top align="center">Prefix to be attached to lines.</td> + <td vAlign=top align="center">Yes</td> + </tr> +</table> +<p> +<h4>Example:</h4> This will attach the prefix <code>Foo</code> to all lines. -<BLOCKQUOTE><PRE> +<blockquote><pre> <filterreader classname="org.apache.tools.ant.filters.PrefixLines"> <param name="prefix" value="Foo"/> </filterreader> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <prefixlines prefix="Foo"/> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="replacetokens">ReplaceTokens</a></H3> +<h3><a name="replacetokens">ReplaceTokens</a></h3> This filter reader replaces all strings that are sandwiched between begintoken and endtoken with user defined values. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Type</B></TD> - <TD vAlign=top><B>Parameter Name</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>tokenchar</TD> - <TD vAlign=top>begintoken</TD> - <TD vAlign=top>Character marking the - beginning of a token. Defaults to @</TD> - <TD vAlign=top align="center">No</TD> - </TR> - <TR> - <TD vAlign=top>tokenchar</TD> - <TD vAlign=top>endtoken</TD> - <TD vAlign=top>Character marking the - end of a token. Defaults to @</TD> - <TD vAlign=top align="center">No</TD> - </TR> - <TR> - <TD vAlign=top>token</TD> - <TD vAlign=top>User defined String.</TD> - <TD vAlign=top>User defined search String</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> -</TABLE> -<P> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Type</b></td> + <td vAlign=top><b>Parameter Name</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>tokenchar</td> + <td vAlign=top>begintoken</td> + <td vAlign=top>Character marking the + beginning of a token. Defaults to @</td> + <td vAlign=top align="center">No</td> + </tr> + <tr> + <td vAlign=top>tokenchar</td> + <td vAlign=top>endtoken</td> + <td vAlign=top>Character marking the + end of a token. Defaults to @</td> + <td vAlign=top align="center">No</td> + </tr> + <tr> + <td vAlign=top>token</td> + <td vAlign=top>User defined String.</td> + <td vAlign=top>User defined search String</td> + <td vAlign=top align="center">Yes</td> + </tr> +</table> +<p> -<H4>Example:</H4> +<h4>Example:</h4> This replaces occurrences of the string @DATE@ in the data with today's date and stores it in the property ${src.file.replaced} -<BLOCKQUOTE><PRE> +<blockquote><pre> <tstamp/> <loadfile srcfile="${src.file}" property="${src.file.replaced}"> <filterchain> @@ -432,10 +432,10 @@ </filterreader> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <tstamp/> <loadfile srcfile="${src.file}" property="${src.file.replaced}"> <filterchain> @@ -444,75 +444,75 @@ </replacetokens> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="stripjavacomments">StripJavaComments</a></H3> +<h3><a name="stripjavacomments">StripJavaComments</a></h3> This filter reader strips away comments from the data, using Java syntax guidelines. This filter does not take in any parameters. -<P> -<H4>Example:</H4> +<p> +<h4>Example:</h4> -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${java.src.file}" property="${java.src.file.nocomments}"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.StripJavaComments"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${java.src.file}" property="${java.src.file.nocomments}"> <filterchain> <stripjavacomments/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="striplinebreaks">StripLineBreaks</a></H3> +<h3><a name="striplinebreaks">StripLineBreaks</a></h3> This filter reader strips away specific characters from the data supplied to it. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Name</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>linebreaks</TD> - <TD vAlign=top align="center">Characters that are to - be stripped out. Defaults to "\r\n"</TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> -<P> -<H4>Examples:</H4> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Name</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>linebreaks</td> + <td vAlign=top align="center">Characters that are to + be stripped out. Defaults to "\r\n"</td> + <td vAlign=top align="center">No</td> + </tr> +</table> +<p> +<h4>Examples:</h4> This strips the '\r' and '\n' characters. -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.contents}"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.StripLineBreaks"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.contents}"> <filterchain> <striplinebreaks/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> This treats the '(' and ')' characters as line break characters and strips them. -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.contents}"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.StripLineBreaks"> @@ -520,31 +520,31 @@ </filterreader> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="striplinecomments">StripLineComments</a></H3> +<h3><a name="striplinecomments">StripLineComments</a></h3> This filter removes all those lines that begin with strings that represent comments as specified by the user. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Type</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>comment</TD> - <TD vAlign=top align="center">Strings that identify a line as a comment - when they appear at the start of the line.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> -</TABLE> -<P> -<H4>Examples:</H4> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Type</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>comment</td> + <td vAlign=top align="center">Strings that identify a line as a comment + when they appear at the start of the line.</td> + <td vAlign=top align="center">Yes</td> + </tr> +</table> +<p> +<h4>Examples:</h4> This removes all lines that begin with #, --, REM, rem and // -<BLOCKQUOTE><PRE> +<blockquote><pre> <filterreader classname="org.apache.tools.ant.filters.StripLineComments"> <param type="comment" value="#"/> <param type="comment" value="--"/> @@ -552,10 +552,10 @@ <param type="comment" value="rem "/> <param type="comment" value="//"/> </filterreader> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <striplinecomments> <comment value="#"/> <comment value="--"/> @@ -563,166 +563,166 @@ <comment value="rem "/> <comment value="//"/> </striplinecomments> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="tabstospaces">TabsToSpaces</a></H3> +<h3><a name="tabstospaces">TabsToSpaces</a></h3> This filter replaces tabs with spaces -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Name</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>tablength</TD> - <TD vAlign=top align="center">Defaults to "8"</TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> -<P> -<H4>Examples:</H4> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Name</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>tablength</td> + <td vAlign=top align="center">Defaults to "8"</td> + <td vAlign=top align="center">No</td> + </tr> +</table> +<p> +<h4>Examples:</h4> This replaces tabs in ${src.file} with spaces. -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.notab}"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.TabsToSpaces"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.notab}"> <filterchain> <tabstospaces/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="tailfilter">TailFilter</a></H3> +<h3><a name="tailfilter">TailFilter</a></h3> This filter reads the last few lines from the data supplied to it. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Name</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>lines</TD> - <TD vAlign=top align="center">Number of lines to be read. - Defaults to "10" <BR> A negative value means that all lines are - passed (useful with <I>skip</I>)</TD> - <TD vAlign=top align="center">No</TD> - </TR> - <TR> - <TD vAlign=top>skip</TD> - <TD vAlign=top align="center">Number of lines to be skipped (from the end). - Defaults to "0" </TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> -<P> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Name</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>lines</td> + <td vAlign=top align="center">Number of lines to be read. + Defaults to "10" <br> A negative value means that all lines are + passed (useful with <i>skip</i>)</td> + <td vAlign=top align="center">No</td> + </tr> + <tr> + <td vAlign=top>skip</td> + <td vAlign=top align="center">Number of lines to be skipped (from the end). + Defaults to "0" </td> + <td vAlign=top align="center">No</td> + </tr> +</table> +<p> -<H4>Background:</H4> +<h4>Background:</h4> With HeadFilter and TailFilter you can extract each part of a text file you want. This graphic shows the dependencies: -<TABLE cellSpacing=0 cellPadding=2 border=1> -<TR> - <TH> Content </TH> - <TH></TH> - <TH></TH> - <TH></TH> - <TH> Filter </TH> -</TR> -<TR> - <TD> Line 1 </TD> - <TD rowspan="2" bgcolor="#C0C0C0"> </TD> - <TD rowspan="9" bgcolor="#FF00FF"> </TD> - <TD rowspan="4"> </TD> - <TD rowspan="11"> - <TABLE> - <TR> - <TD bgcolor="#C0C0C0"> </TD> - <TD><PRE><filterchain> +<table cellSpacing=0 cellPadding=2 border=1> +<tr> + <th> Content </th> + <th></th> + <th></th> + <th></th> + <th> Filter </th> +</tr> +<tr> + <td> Line 1 </td> + <td rowspan="2" bgcolor="#C0C0C0"> </td> + <td rowspan="9" bgcolor="#FF00FF"> </td> + <td rowspan="4"> </td> + <td rowspan="11"> + <table> + <tr> + <td bgcolor="#C0C0C0"> </td> + <td><pre><filterchain> <headfilter lines="2"/> -</filterchain></PRE></TD> - </TR> - <TR> - <TD bgcolor="#FF00FF"> </TD> - <TD><PRE><filterchain> +</filterchain></pre></td> + </tr> + <tr> + <td bgcolor="#FF00FF"> </td> + <td><pre><filterchain> <tailfilter lines="-1" skip="2"/> -</filterchain></PRE></TD> - </TR> - <TR> - <TD bgcolor="#008000"> </TD> - <TD><PRE><filterchain> +</filterchain></pre></td> + </tr> + <tr> + <td bgcolor="#008000"> </td> + <td><pre><filterchain> <headfilter lines="-1" skip="2"/> -</filterchain></PRE></TD> - </TR> - <TR> - <TD bgcolor="#0000FF"> </TD> - <TD><PRE><filterchain> +</filterchain></pre></td> + </tr> + <tr> + <td bgcolor="#0000FF"> </td> + <td><pre><filterchain> <headfilter lines="-1" skip="2"/> <tailfilter lines="-1" skip="2"/> -</filterchain></PRE></TD> - </TR> - <TR> - <TD bgcolor="#00FF00"> </TD> - <TD><PRE><filterchain> +</filterchain></pre></td> + </tr> + <tr> + <td bgcolor="#00FF00"> </td> + <td><pre><filterchain> <tailfilter lines="2"/> -</filterchain></PRE></TD> - </TR> - </TABLE> - </TD> -</TR> -<TR> - <TD> Line 2 </TD> -</TR> -<TR> - <TD> Line 3 </TD> - <TD rowspan="9" bgcolor="#008000"> </TD> -</TR> -<TR> - <TD> Line 4 </TD> -</TR> -<TR> - <TD> Line 5 </TD> - <TD rowspan="3" bgcolor="#0000FF"> </TD> -</TR> -<TR> - <TD> Lines ... </TD> -</TR> -<TR> - <TD> Line 95 </TD> -</TR> -<TR> - <TD> Line 96 </TD> - <TD rowspan="4"> </TD> -</TR> -<TR> - <TD> Line 97 </TD> -</TR> -<TR> - <TD> Line 98 </TD> - <TD rowspan="2" bgcolor="#00FF00"> </TD> -</TR> -<TR> - <TD> Line 99 </TD> -</TR> -</TABLE> +</filterchain></pre></td> + </tr> + </table> + </td> +</tr> +<tr> + <td> Line 2 </td> +</tr> +<tr> + <td> Line 3 </td> + <td rowspan="9" bgcolor="#008000"> </td> +</tr> +<tr> + <td> Line 4 </td> +</tr> +<tr> + <td> Line 5 </td> + <td rowspan="3" bgcolor="#0000FF"> </td> +</tr> +<tr> + <td> Lines ... </td> +</tr> +<tr> + <td> Line 95 </td> +</tr> +<tr> + <td> Line 96 </td> + <td rowspan="4"> </td> +</tr> +<tr> + <td> Line 97 </td> +</tr> +<tr> + <td> Line 98 </td> + <td rowspan="2" bgcolor="#00FF00"> </td> +</tr> +<tr> + <td> Line 99 </td> +</tr> +</table> -<H4>Examples:</H4> +<h4>Examples:</h4> This stores the last 15 lines of the supplied data in the property ${src.file.tail} -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.tail}"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.TailFilter"> @@ -730,21 +730,21 @@ </filterreader> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.tail}"> <filterchain> <tailfilter lines="15"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> This stores the last 5 lines of the first 15 lines of the supplied data in the property ${src.file.mid} -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.mid}"> <filterchain> <filterreader classname="org.apache.tools.ant.filters.HeadFilter"> @@ -755,114 +755,114 @@ </filterreader> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> Convenience method: -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.mid}"> <filterchain> <headfilter lines="15"/> <tailfilter lines="5"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> This stores the last 10 lines, skipping the last 2 lines, of the supplied data in the property ${src.file.head}. (Means: if supplied data contains 60 lines, lines 49-58 are extracted) -<BLOCKQUOTE><PRE> +<blockquote><pre> <loadfile srcfile="${src.file}" property="${src.file.head}"> <filterchain> <tailfilter lines="10" skip="2"/> </filterchain> </loadfile> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="deletecharacters">DeleteCharacters</a></H3> +<h3><a name="deletecharacters">DeleteCharacters</a></h3> <p>This filter deletes specified characters.</p> <p><em>since Ant 1.6</em></p> <p>This filter is only available in the convenience form.</p> -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Name</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>chars</TD> - <TD vAlign=top> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Name</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>chars</td> + <td vAlign=top> The characters to delete. This attribute is <a href="#backslash">backslash enabled</a>. - </TD> - <TD vAlign=top align="center">Yes</TD> - </TR> -</TABLE> -<P> -<H4>Examples:</H4> + </td> + <td vAlign=top align="center">Yes</td> + </tr> +</table> +<p> +<h4>Examples:</h4> Delete tabs and returns from the data. -<BLOCKQUOTE><PRE> +<blockquote><pre> <deletecharacters chars="\t\r"/> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="concatfilter">ConcatFilter</a></H3> +<h3><a name="concatfilter">ConcatFilter</a></h3> <p>This filter prepends or appends the content file to the filtered files.</p> <p><em>since Ant 1.6</em></p> -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Parameter Name</B></TD> - <TD vAlign=top><B>Parameter Value</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>prepend</TD> - <TD vAlign=top> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Parameter Name</b></td> + <td vAlign=top><b>Parameter Value</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>prepend</td> + <td vAlign=top> The name of the file which content should be prepended to the file. - </TD> - <TD vAlign=top align="center">No</TD> - </TR> - <TR> - <TD vAlign=top>append</TD> - <TD vAlign=top> + </td> + <td vAlign=top align="center">No</td> + </tr> + <tr> + <td vAlign=top>append</td> + <td vAlign=top> The name of the file which content should be appended to the file. - </TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> -<P> + </td> + <td vAlign=top align="center">No</td> + </tr> +</table> +<p> -<H4>Examples:</H4> +<h4>Examples:</h4> Do nothing: -<BLOCKQUOTE><PRE> +<blockquote><pre> <filterchain> <concatfilter/> </filterchain> -</PRE></BLOCKQUOTE> +</pre></blockquote> Adds a license text before each java source: -<BLOCKQUOTE><PRE> +<blockquote><pre> <filterchain> <concatfilter prepend="apache-license-java.txt"/> </filterchain> -</PRE></BLOCKQUOTE> +</pre></blockquote> -<H3><a name="tokenfilter">TokenFilter</a></H3> +<h3><a name="tokenfilter">TokenFilter</a></h3> This filter tokenizes the inputstream into strings and passes these strings to filters of strings. Unlike the other filterreaders, this does not support params, only convenience methods are implemented. The tokenizer and the string filters are defined by nested elements. -<P><em>since Ant 1.6</em></p> -<P> +<p><em>since Ant 1.6</em></p> +<p> Only one tokenizer element may be used, the LineTokenizer is the default if none are specified. A tokenizer splits the input into token strings and trailing delimiter strings. -<P> +<p> There may be zero or more string filters. A string filter processes a token and either returns a string or a null. It the string is not null it is passed to the next filter. This @@ -872,30 +872,30 @@ (if one is present). The trailing delimiter may be overridden by the <i>delimOutput</i> attribute. -<P> +<p> <a name="backslash"><em>blackslash interpretation</em></a> A number of attributes (including <i>delimOutput</i>) interpret backslash escapes. The following are understood: \n, \r, \f, \t and \\. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>delimOutput</TD> - <TD vAlign=top> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>delimOutput</td> + <td vAlign=top> This overrides the tokendelimiter returned by the tokenizer if it is not empty. This attribute is backslash enabled. -</TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> -<P> +</td> + <td vAlign=top align="center">No</td> + </tr> +</table> +<p> The following tokenizers are provided by the default distribution. <p> @@ -925,58 +925,58 @@ is added to the filter to specify whether to use a linetokenizer (byline="true") or a filetokenizer (byline="false"). The default is "true". -<P> +<p> <p><b><em><a name="linetokenizer">LineTokenizer</a></em></b></p> This tokenizer splits the input into lines. The tokenizer delimits lines by "\r", "\n" or "\r\n". This is the default tokenizer. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>includeDelims</TD> - <TD vAlign=top> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>includeDelims</td> + <td vAlign=top> Include the line endings in the token. Default is false. - </TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> -<H4>Examples:</H4> + </td> + <td vAlign=top align="center">No</td> + </tr> +</table> +<h4>Examples:</h4> Convert input current line endings to unix style line endings. -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter delimoutput="\n"/> -</PRE></BLOCKQUOTE> +</pre></blockquote> Remove blank lines. -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <ignoreblank/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> <p><b><em><a name="filetokenizer">FileTokenizer</a></em></b></p> This tokenizer treats <b>all</b> the input as a token. So be careful not to use this on very large input. -<H4>Examples:</H4> +<h4>Examples:</h4> Replace the first occurrence of package with //package. -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <filetokenizer/> <replaceregex pattern="([\n\r]+[ \t]*|^[ \t]*)package" flags="s" replace="\1//package"/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> <p><b><em><a name="stringtokenizer">StringTokenizer</a></em></b></p> This tokenizer is based on java.util.StringTokenizer. @@ -986,20 +986,20 @@ token will be the empty string (unless the <i>delimsaretokens</i> attribute is used). -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>delims</TD> - <TD vAlign=top>The delimiter characters. White space +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>delims</td> + <td vAlign=top>The delimiter characters. White space is used if this is not set. (White space is defined in this case by java.lang.Character.isWhitespace()). - </TD> - <TD vAlign=top align="center">No</TD> - </TR> + </td> + <td vAlign=top align="center">No</td> + </tr> <tr> <td valign="top">delimsaretokens</td> <td valign="top">If this is true, @@ -1024,35 +1024,35 @@ </td> <td vAlign=top align="center">No</td> </tr> -</TABLE> +</table> -<H4>Examples:</H4> +<h4>Examples:</h4> Surround each non space token with a "[]". -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <stringtokenizer/> <replaceregex pattern="(.+)" replace="[\1]"/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> <p><b><em><a name="replacestring">ReplaceString</a></em></b></p> This is a simple filter to replace strings. This filter may be used directly within a filterchain. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>from</TD> - <TD vAlign=top>The string that must be replaced.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>from</td> + <td vAlign=top>The string that must be replaced.</td> + <td vAlign=top align="center">Yes</td> + </tr> <tr> <td valign="top">to</td> <td valign="top">The new value for the replaced string. When omitted @@ -1060,45 +1060,45 @@ </td> <td valign="top" align="center">No</td> </tr> -</TABLE> +</table> -<H4>Examples:</H4> +<h4>Examples:</h4> Replace "sun" with "moon". -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <replacestring from="sun" to="moon"/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> <p><b><em><a name="containsstring">ContainsString</a></em></b></p> This is a simple filter to filter tokens that contains a specified string. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>contains</TD> - <TD vAlign=top>The string that the token must contain.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> -</TABLE> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>contains</td> + <td vAlign=top>The string that the token must contain.</td> + <td vAlign=top align="center">Yes</td> + </tr> +</table> -<H4>Examples:</H4> +<h4>Examples:</h4> Include only lines that contain "foo"; -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <containsstring contains="foo"/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> <p><b><em><a name="replaceregex">ReplaceRegex</a></em></b></p> This string filter replaces regular expressions. @@ -1108,42 +1108,42 @@ concerning the choice of the implementation. </p> -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>pattern</TD> - <TD vAlign=top>The regular expression pattern to match in - the token.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> - <TR> - <TD vAlign=top>replace</TD> - <TD vAlign=top>The substitution pattern to replace the matched - regular expression. When omitted an empty string is used.</TD> - <TD vAlign=top align="center">No</TD> - </TR> - <TR> - <TD vAlign=top>flags</TD> - <TD vAlign=top>See +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>pattern</td> + <td vAlign=top>The regular expression pattern to match in + the token.</td> + <td vAlign=top align="center">Yes</td> + </tr> + <tr> + <td vAlign=top>replace</td> + <td vAlign=top>The substitution pattern to replace the matched + regular expression. When omitted an empty string is used.</td> + <td vAlign=top align="center">No</td> + </tr> + <tr> + <td vAlign=top>flags</td> + <td vAlign=top>See <a href="../OptionalTasks/replaceregexp.html">ReplaceRegexp</a> -for an explanation of regex flags.</TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> -<H4>Examples:</H4> +for an explanation of regex flags.</td> + <td vAlign=top align="center">No</td> + </tr> +</table> +<h4>Examples:</h4> Replace all occurrences of "hello" with "world", ignoring case. -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <replaceregex pattern="hello" replace="world" flags="gi"/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> <p><b><em><a name="containsregex">ContainsRegex</a></em></b></p> This filters strings that match regular expressions. @@ -1154,55 +1154,55 @@ <a href="../CoreTypes/regexp.html#implementation">Regexp Type</a> concerning the choice of regular expression implementation. </p> -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>pattern</TD> - <TD vAlign=top>The regular expression pattern to match in - the token.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> - <TR> - <TD vAlign=top>replace</TD> - <TD vAlign=top>The substitution pattern to replace the matched +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>pattern</td> + <td vAlign=top>The regular expression pattern to match in + the token.</td> + <td vAlign=top align="center">Yes</td> + </tr> + <tr> + <td vAlign=top>replace</td> + <td vAlign=top>The substitution pattern to replace the matched regular expression. When omitted the orignal token is returned. - </TD> - <TD vAlign=top align="center">No</TD> - </TR> - <TR> - <TD vAlign=top>flags</TD> - <TD vAlign=top>See + </td> + <td vAlign=top align="center">No</td> + </tr> + <tr> + <td vAlign=top>flags</td> + <td vAlign=top>See <a href="../OptionalTasks/replaceregexp.html">ReplaceRegexp</a> -for an explanation of regex flags.</TD> - <TD vAlign=top align="center">No</TD> - </TR> -</TABLE> +for an explanation of regex flags.</td> + <td vAlign=top align="center">No</td> + </tr> +</table> -<H4>Examples:</H4> +<h4>Examples:</h4> Filter lines that contain "hello" or "world", ignoring case. -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <containsregex pattern="(hello|world)" flags="i"/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> This example replaces lines like "SUITE(TestSuite, bits);" with "void register_bits();" and removes other lines. -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <containsregex pattern="^ *SUITE\(.*,\s*(.*)\s*\).*" replace="void register_\1();"/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> <p><b><em><a name="trim">Trim</a></em></b></p> This filter trims whitespace from the start and end of @@ -1214,32 +1214,32 @@ <p><b><em><a name="filterdeletecharacters">DeleteCharacters</a></em></b></p> This filter deletes specified characters from tokens. -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>chars</TD> - <TD vAlign=top>The characters to delete. This attribute - is backslash enabled.</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> -</TABLE> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>chars</td> + <td vAlign=top>The characters to delete. This attribute + is backslash enabled.</td> + <td vAlign=top align="center">Yes</td> + </tr> +</table> -<H4>Examples:</H4> +<h4>Examples:</h4> Delete tabs from lines, trim the lines and removes empty lines. -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <deletecharacters chars="\t"/> <trim/> <ignoreblank/> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> <p><b><em><a name="scriptfilter">ScriptFilter</a></em></b></p> This is an optional filter that executes a script in a @@ -1256,37 +1256,37 @@ </p> This filter may be used directly within a filterchain.<p> -<TABLE cellSpacing=0 cellPadding=2 border=1> - <TR> - <TD vAlign=top><B>Attribute</B></TD> - <TD vAlign=top><B>Description</B></TD> - <TD vAlign=top align="center"><B>Required</B></TD> - </TR> - <TR> - <TD vAlign=top>language</TD> - <TD vAlign=top> The programming language the script is written in. -Must be a supported Apache BSF language</TD> - <TD vAlign=top align="center">Yes</TD> - </TR> - <TR> - <TD vAlign=top>src</TD> - <TD vAlign=top>The location of the script as a file, if not inline - </TD> - <TD vAlign=top align="center">No</TD> - </TR> - <TR> -</TABLE> +<table cellSpacing=0 cellPadding=2 border=1> + <tr> + <td vAlign=top><b>Attribute</b></td> + <td vAlign=top><b>Description</b></td> + <td vAlign=top align="center"><b>Required</b></td> + </tr> + <tr> + <td vAlign=top>language</td> + <td vAlign=top> The programming language the script is written in. +Must be a supported Apache BSF language</td> + <td vAlign=top align="center">Yes</td> + </tr> + <tr> + <td vAlign=top>src</td> + <td vAlign=top>The location of the script as a file, if not inline + </td> + <td vAlign=top align="center">No</td> + </tr> + <tr> +</table> -<H4>Examples:</H4> +<h4>Examples:</h4> Convert to uppercase: -<BLOCKQUOTE><PRE> +<blockquote><pre> <tokenfilter> <scriptfilter language="javascript"> self.setToken(self.getToken().toUpperCase()); </scriptfilter> </tokenfilter> -</PRE></BLOCKQUOTE> +</pre></blockquote> Remove lines containing the string "bad" while copying text files: @@ -1303,7 +1303,7 @@ </pre> </blockquote> -<H4>Custom tokenizers and string filters</H4> +<h4>Custom tokenizers and string filters</h4> Custom string filters and tokenizers may be plugged in by extending the interfaces org.apache.tools.ant.filters.TokenFilter.Filter @@ -1341,7 +1341,7 @@ </copy> </pre></blockquote> -<HR> +<hr> -<P align=center>Copyright © 2002-2005 The Apache Software Foundation. All rights -Reserved.</P></BODY></HTML> +<p align=center>Copyright © 2002-2005 The Apache Software Foundation. All rights +Reserved.</p></body></html>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]