XmlFeedConfig

Table of contents

No headers

XmlFeedConfig is a data mapping configuration bean to support data collection from XML sources.

Elements from the XML document can be mapped to CC-Record fields as output at any level in the document. Initial input is the document node or root element. A set of child elements can be mapped to output by providing an XPath expression for the nodes of interest. Each matching node is then processed according to output mappings specific to the expression results. By default, identifiers accumulate in the record, but resources do not.

Recursive Processing

The parent output record is cloned and resources dropped before processing each child node. The recursive nature of the document is supported by the
XPathOutputMapping
, which is also recursive and supports nesting expressions and mappings. In this way, identifiers can be accumulated for the context of a node containing usage data for one or more resources.

Variables

Input can be mapped to a mutable variable instead of an output field. These variables may then be specified in place of a literal input field where necessary. To specify a variable as input, set the input name to '#' followed by the variable name.

Mapping Output

Outputs correspond to a CC-Record field and typically name an element as the input. Input names can employ a dot notation to pull nested element data. This is convenient in many cases, but limited to the first match and not intended to satisfy recursive processing needs. For example, "
company.name
" as an input would pull the value of a '
name
' element contained in a '
customer
' child element of the current node.

When using expressions to match nodes, the inputs are relative to the matching nodes. This presents a special case where the value of the matching node is needed as input and there is no attribute or child element name to provide as input. In these cases, specify "
/
" as the input. This will pull the current nodes value. To specify an attribute value as input, prefix the attribute name with '
@
' as the input. For example, "
company.@name
" as an input would pull the value of an attribute called 'name' from a child element called '
company
'.

Data Sample

In the following example, the customer data can be mapped into identifiers that are included on all output records for the document. The service node and children can be mapped recursively such that the
vmName identifier appears in all records having service resources.

<subscription>

<customer>

<name>ABC Corp</name>

</customer>

<service>

<vmName>9283479</vmName>

<compute>

<osType>Windows 2008 R2</osType>

<ramGB>4</ramGB>

<cpuCount>2</cpuCount>

</compute>

<disks>

<disk>

<name>Disk-1</name>

<sizeGB>400</sizeGB>

</disk>

<disk>

<name>Disk-2</name>

<sizeGB>2000</sizeGB>

</disk>

</disks>

</service>

</subscription>

Output Sample:

The following CSV represents typical output from mapping the above data sample as prescribed:

Sets a list of element to variable mappings. The output variables may then be specified as input for subsequent output mappings. To specify a variable as input, set the input to '
#
' followed by the variable name. For example, setting an input of
#serviceId would populate the output from an output variable named '
serviceId
'.