<Filter> element

Syntax

Parent element: <Get>, <Diff>, <PropertyDef>, <Property>

Usage

The content of the <Filter> element is a command to which the output of the command line generated for the operation defined in the parent element is passed as input.

Some characters often found in shell expressions, such as <, > and & are not allowed in XML documents. These characters will need to be replaced by the corresponding XML entity:

Table 1. XML entities
Character XML entity
< &lt;
> &gt;
& &amp;

Alternatively, a CDATA section can be used if the expression contains many of such characters. The CDATA sections start with <![CDATA[ and ends with ]]>.

Example

The nfsParam.xml catalog uses the <Filter> element for the get operation of parameter v4_root_node to extract the root node from the output of the nfds –getnode command:
<ParameterDef id="v4_root_node">
  <Get type="current">
    <Command>
       /usr/sbin/nfsd -getnodes
    </Command>
    <Filter>
       /usr/bin/awk -F: 'NR == 2 { printf("%s", $1) }'
    </Filter>
  </Get>
</ParameterDef>

Related information

Command line generation