NAnt SDK Documentation - v0.92

FilterChain Class

Represent a chain of NAnt filters that can be applied to a Task.

For a list of all members of this type, see FilterChain Members.

System.Object
   NAnt.Core.Element
      NAnt.Core.DataTypeBase
         NAnt.Core.Filters.FilterChain

[Visual Basic]
<Serializable, _  Serializable, _  ElementName(Name:="filterchain")>
Public Class FilterChain
    Inherits DataTypeBase
[C#]
[Serializable]
[Serializable]
[ElementName(Name="filterchain")]
public class FilterChain : DataTypeBase

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

A FilterChain represents a collection of one or more filters that can be appled to a Task such as the CopyTask. In the case of the CopyTask, the contents of the copied files are filtered through each filter specified in the filter chain. Filtering occurs in the order the filters are specified with filtered output of one filter feeding into another.

:--------:--->:----------:--->:----------: ... :----------:--->:--------:
:.Source.:--->:.Filter 1.:--->:.Filter 2.: ... :.Filter n.:--->:.target.:
:--------:--->:----------:--->:----------: ... :----------:--->:--------:

A list of all filters that come with NAnt is available here.

The following tasks support filtering with a FilterChain:

Example

Replace all occurrences of @NOW@ with the current date/time and replace tabs with spaces in all copied files.

    
<property name="NOW" value="${datetime::now()}" />
<copy todir="out">
    <fileset basedir="in">
        <include name="**/*" />
    </fileset>
    <filterchain>
        <replacetokens>
            <token key="NOW" value="${TODAY}" />
        </replacetokens>
        <tabstospaces />
    </filterchain>
</copy>
    
  

Requirements

Namespace: NAnt.Core.Filters

Assembly: NAnt.Core (in NAnt.Core.dll)

See Also

FilterChain Members | NAnt.Core.Filters Namespace