Home > Cloud Cruiser 4 > Collecting, transforming, and publishing > XML > Advanced configuration

Advanced configuration

This article explains how to use the Advanced Configuration dialog box for an XML collection. The same concepts and interfaces also apply to output field mapping for native collectors that retrieve data in XML format. 

Input settings

The Input Settings tab was added in version 4.1. The properties there are also available in the basic configuration. For information, see Collector properties.

Output fields

In the Output Fields tab for an XML collection, you can map data to output fields for the source document's root node and any number of other nodes matching XPath expressions you specify.

When you first open the Advanced Configuration dialog box for an XML collection, Cloud Cruiser reads your data source and automatically adds XPath expressions and output fields for all elements. This default configuration helps you collect everything from your data source with minimal effort, but you can modify it. For example, you might want to combine measures into fewer output records by using dot notation instead of nested XPath expressions to access lower-level elements.

Root node

The root node of your source document does not generate a CC Record. The dimensions you map for the root node are inherited by all the other nodes you select, so these fields appear in records generated by those nodes. If you want the root element of your source XML document to generate a record, create an XPath expression for it instead of using the built-in Root node.

To specify output fields for the root node

  1. Select Root in the top pane.
    If you haven't yet added any XPath expressions, Root is already selected because it's the only object in the pane.
  2. In the second pane, click Add Row and fill out the fields.
    They work the same as for any other type of collection. XML-specific syntax for the Input field is described in the following section Syntax.

Selecting other nodes with XPath expressions

Each node in the source document that matches an XPath expression you specify generates a CC Record.

To specify output fields for a node

  1. Use the Plus icon buttons to add a new XPath expression at the desired place in the hierarchy. The following screenshot shows where each button creates an expression:

    Screenshot with callouts stating the location where each button adds an XPath expression
  2. In the second pane, click Add Row and fill out the fields.
    They work the same as for any other type of collection. XML-specific syntax for the Input field is described in the following section Syntax.

To match a root element (any element at the top level), precede its name with a slash. For example, /VirtualMachine.

Avoid XPath expressions that begin with two slashes, such as //VirtualMachine. These match elements at any node in the XML document. Use expressions that match a given element only at a particular location.

Syntax

In the Input for an output field, use one of the following to specify the input value for the field:

  • The name of an element of the current node. For example, the input name would pull the value of the name element of the current node.
  • Dot notation to specify a child element. For example, the input company.name would pull the value of the name element of the company element of the current node.
  • A slash (/) to specify the value of the current node itself.
  • An asterisk (@) to prefix the name of an attribute. For example, the input company.@name would pull the value of the attribute name of a company element of the current node.

Mapping recursive elements

You can map most child elements of a selected node using output fields for that node, with each element becoming a measure or dimension together in a single CC Record. But this approach breaks down when there are multiple instances of an element at the same level. In this case only the first such element is mapped to the output record.

For example, in the following source example, the disks element contains two instances of its child element disk . The name and size of only the first disk are written to the output record for the node and the second disk is lost.

To capture multiple elements at the same level in your collector output, instead provide an XPath expression to match that element, as in Mapping example. The output fields in that example map three dimensions and two measures to an output record for each subscription, plus a dimension and a measure to an output record for each disk. That produces the three CC Records in Output example, capturing both disks.

Source example

In the following example, the subscription element is the root node of the document. customer data can be mapped into dimensions that are included on all output records for the document. The service node and children can be mapped recursively so that the vmName dimension appears in all records having service measures.

<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>

Mapping example

The following screenshots show the recommended way to map output for this source. The first shows output fields for the root node and the second shows output fields for each disk.

 Output field mappings for the example source, in the Advanced Configuration dialog box
(Click image to expand)

Output example

The following CSV represents the output from the previous source and mapping examples. Usage dates and times are omitted to save space:

...3,Customer,ABC Corp,VM Name,9283479,OS Type,Windows 2008 R2,2,RAM,4,CPU Count,2
...4,Customer,ABC Corp,VM Name,9283479,OS Type,Windows 2008 R2,Disk Name,Disk‐1,1,Disk Size,400
...4,Customer,ABC Corp,VM Name,9283479,OS Type,Windows 2008 R2,Disk Name,Disk‐2,1,Disk Size,2000

Measure Qualifier

Enter the name of an output dimension in this field to prepend that dimension's value to the names of all measures collected from a given node. For more information, see Measure qualifiers.

Accumulate option

To accumulate the output fields from a node in the record for its parent node, select Accumulate to the right of the expression. You can accumulate as many times as you want within the same hierarchy, as shown in the following screenshot:

Screenshot of three nested XPath expressions, all with Accumulate selected

In this example, the output fields accumulate all the way to Root.

Creating and using variables

This section explains the steps for creating and using a variable. To understand variables, see Using variables to access values from other nodes.

To create a variable

  1. Click the Variables tab in the second pane (below the XPath expressions), then click Add Row.
    An empty row is added to the variables table.
  2. In the Alias field, enter the name by which you want to reference this variable in an output field mapping.
  3. In the Input field, enter the XML input to become the variable's value.
    This field works just like the Input field on the Fields tab.

The following screenshot shows the variable customerName created to hold the value of the element name of the node customer:​

Screenshot of a variable definition
(Click image to expand)

To use a variable

  • In the Input field of an output field mapping, enter #<variableName>.
    For example, #myvariable.

The following screenshot shows an output field referencing the variable from the previous example as its input:

Screenshot of a variable being referenced
(Click image to expand)

Last modified

Tags

Classifications

This page has no classifications.
© Copyright 2018 Hewlett Packard Enterprise Development LP