Detailed Examples for Setting an Extraction Path

These examples provide additional details and information about how to set an extraction path using the Event Action Set Extract XML Collection form.

For these examples, the XML template is this:

<OrderLines>
   <OrderLine>
      <CoLine/>
      <CoNum/>
      <CoRelease/>
      <Item/>
      <QtyShipped/>
   </OrderLine>
</OrderLines>

The XML from which we want to extract data is this:

<OrderLines>
   <OrderLine>
      <CoLine>1</CoLine>
      <CoNum>         132</CoNum>
      <CoRelease>0</CoRelease>
      <Item>FA-10000</Item>
      <QtyShipped>10.00000000</QtyShipped>
   </OrderLine>
   <OrderLine>
      <CoLine>2</CoLine>
      <CoNum>         132</CoNum>
      <CoRelease>0</CoRelease>
      <Item>FA-20000</Item>
      <QtyShipped>0.00000000</QtyShipped>
   </OrderLine>
</OrderLines>

Example 1

Suppose you want to extract both of the "OrderLine" elements as rows.

To do this in the Event Action Set Extract XML Collection form, you would:

  1. Click on the "OrderLine" node in the template.
  2. Click Set Current Path As Extraction Path To Select Collection.

    This sets the Extraction Path to: //OrderLines[1]/OrderLine

This extraction path selects every "OrderLine" element that is a child of the first "OrderLines" element in the XML.

Example 2

Now suppose that, instead, you want to extract only the first "OrderLine" element as a row.

To do this in the Event Action Set Extract XML Collection form, you would:

  1. Click on the "OrderLine" node in the template.
  2. Click Set Current Path As Extraction Path To Select Single Row.

    This sets the Extraction Path to: //OrderLines[1]/OrderLine[1]

This extraction path selects just the first "OrderLine" element that is a child of the first "OrderLines" element in the XML.

Final note...

These are simple examples. If your XML is more complex—which is likely—, you can enter a more complex XPath expression to select the desired elements from wherever they reside in the XML.


Related Topics

Event Action Set Extract XML Collection (Setting an Extraction Path)

Event Action Extract XML Collection