---
title: "Policy Rule XML Capabilities"
canonical: "https://docs.infoblox.com/space/netmri760/357238623/Policy%20Rule%20XML%20Capabilities"
format: markdown
---
You can perform the following operations and use the following features in policy rules:

- Searches within Lists (defined in the **Configuration** **Management** > **Job** **Management** > **Lists** page) of comma-delimited values to enforce consistency and reduce the number of rules needed to perform similar tasks. Enables better integration of scripts and policies (for example, see *[Using List Searches](https://infoblox-docs.atlassian.net/wiki/spaces/netmri760/pages/357206329)*);
- Calling a Policy Rule from within another Rule –The new `PolicyRuleCall` element may be used to call one rule from within another. This enables improved re-use of rule logic and works something like a function call. The caller may override the severity of the called rule;
- Configuration block checks – supplements or replaces the CPD functionality used in the CPD editor. It allows you to break a configuration file into blocks, and then perform analysis on each of those blocks. These may be nested as desired by the administrator writing the rule. For more information, see *[Using Configuration Block Checks](https://infoblox-docs.atlassian.net/wiki/spaces/netmri760/pages/357369944)*;
- Use expressions to perform logical and mathematical operations, and for reading variables. You use the Expr element to perform these and other actions (for more information, see *[Regular Expressions in Policy Rules](https://infoblox-docs.atlassian.net/wiki/spaces/netmri760/pages/357238370)* and the section *[Using the Expression <Expr> Element](https://infoblox-docs.atlassian.net/wiki/spaces/netmri760/pages/357369925)*);
- Support for arrays. Array indices begin at Zero. In XML rules, the Expr element can use the following operators to work with arrays:

|  |  |
| --- | --- |
| `array` | Convert child expressions into an array. |
| `element-at` | Return the element at a specific array index. |
| `push` | Add one or more elements to the end of an array. |
| `pop` | Remove and return the last element of an array. |
| `unshift` | Add one or more elements to the beginning of an array. |
| `shift` | Remove and return the element at the beginning of an array. |
| `join` | Convert an array to a delimited string. |
| `size` | Return the size of an array. |
| `delete-at` | Remove an element at a location in the array, moving later elements inward. Returns the removed element. |
| `insert-at` | Insert an element at a specified location in the array, moving later elements outward. |
| `assign-at` | Sets the value of an element in a specified location in the array, overwriting the existing element. |
| `in` | Determine if an array contains a specific value. |
| `not-in` | Determine if an array does not contain a specific value. |

- Looping. The Raw XML Editor supports two types of looping, including:
  - **ForEach**, which loops through an array, executing the **Do** code block once in each array element until the condition is met. It takes the form:

`<ForEach>`  
`  expression `  
`   <Do>`  
`    statements `  
`    ...`  
`   </Do>`  
` </ForEach>`

- **While**, which loops until a condition is met. It takes the form:

`<While>`  
`  expression `  
`   <Do>`  
`    statements `  
`    ...`  
`   </Do>`  
` </While>`

- A new **Map** element enables a transformation of all elements in an array, by executing a block of statements for each element in the array, returning a rewritten array as the result. It takes the form:

`<Map>`  
`  expression `  
`   <Do>`  
`    statements `  
`    ...`  
`   </Do>`  
` </Map>`

The *expression* is evaluated as an array; for each element, a variable (using the default name `_map_value`) is automatically set and the rule executes the **Do** code block.  
**Map** and **ForEach** differ because the return value of **ForEach** is the value of the last executed statement in the **Do** block; the return value of the Map element is an array, with each entry being the return value of the **Do** block for the corresponding entry in the input array. For example, the following code block produces a variable called newarray that contains the values 1, 2, 3, and 4:

`<Map output="newarray">`  
`  <Expr op="array">`  
`   <Expr value="0"/>`  
`   <Expr value="1"/>`  
`   <Expr value="2"/>`  
`   <Expr value="3"/>`  
`  </Expr>`  
`  <Do> `  
`  <Expr op="+">`  
`    <Expr variable="_map_value"/>`  
`    <Expr value="1"/>`  
`   </Expr>`  
`  </Do>`  
` </Map>`

An example of this type can be useful in combination with methods accessible on an object. The following code block produces an array of interface names:

`<Map output="interface_names">`  
`  <Expr field="interfaces"/>`  
`  <Do>`  
`    <Expr object="_map_value" field="ifName"/>`  
`  </Do>`  
` </Map>`