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.

These examples use this XML template:

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

This is the XML from which we want to extract data:

<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

To extract both of the "OrderLine" elements as rows:

  • Open the Event Action Set Extract XML Collection form.
  • Click on the "OrderLine" node in the template.
  • 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

To extract only the first "OrderLine" element as a row, you must:

  • Open the Event Action Set Extract XML Collection form.
  • Click on the "OrderLine" node in the template.
  • 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.

Note

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

Related topics