Apama 10.3 | Apama Documentation | Connecting Apama Applications to External Components | Standard IAF Plug-ins | Codec IAF Plug-ins | The XML codec IAF plug-in | Sequence field example
Sequence field example
Consider the following XML fragment:
   <prices instr="MSFT">
      <info type="SELL">1.03</info>
   <prices instr="IBM">
      <info type="BUY"></info>
      <info type="SELL">1.06</info>
Suppose that the following properties are set in the XML codec section of the IAF configuration file:
<property name="XMLField" value="Test"/>
<property name="sequenceField" value="Test.root/prices/@instr"/>
<property name="sequenceField" value="Test.root/prices/info/@type"/>
<property name="sequenceField" value="Test.root/prices/info/text()"/>
<property name="ensurePresent" value="Test.root/prices/info/@type"/>
<property name="ensurePresent" value="Test.root/prices/info/text()"/>
<property name="separator:Test.root/prices" value="(prices)"/>
With these property values, the XML fragment maps to the following normalized event fields:
"Test.root/"                  =
"Test.root/prices#1/"         =
"Test.root/prices#1/info#1/"  =
"Test.root/prices#1/info#2/"  =
"Test.root/prices#2/"         =
"Test.root/prices#2/info#1/"  =
"Test.root/prices#2/info#2/"  =
"Test.root/prices/@instr"     = ["(prices)", "MSFT", "(prices)", "IBM"]
"Test.root/prices/info/@type" =
["(prices)", "", "SELL", "(prices)", "BUY", "SELL"]
["(prices)", "1.04", "1.03", "(prices)", "", "1.06"]
If you define the following mapping rules in the IAF configuration file, you can map these normalized event fields to and from string fields in a sequence field of an Apama event.
   <map transport="Test.root/prices/@instr"
        apama="instruments" type="reference"
        referencetype="sequence &lt;string&gt;" default="[]"/>
   <map transport="Test.root/prices/info/@type"
      apama="types" type="reference"
      referencetype="sequence &lt;string&gt;" default="[]"/>
   <map transport="Test.root/prices/info/text()"
      apama="prices" type="reference"
      referencetype="sequence &lt;string&gt;" default="[]"/>

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.