cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping IDoc node and subnode from the same xml node

Former Member
0 Kudos

Hello

I have ascenario in PI where I recieve an XML document in the format.


<root>
   <node attribute1="Att1Val1" attribute2="Att2Val1">Value1</node>
   <node attribute1="Att1Val2" attribute2="Att2Val2">Value2</node>
   ...
</root>

I want to map the data to an IDoc in the format

 
<idoc>
   ...
   <znode>
      <attribute1>Att1Val1</attribute1>
      <attribute2>Att2Val1</attribute2>
      <znodeval>Value1</znodeval>
  </znode>
   <znode>
      <attribute1>Att1Val2</attribute1>
      <attribute2>Att2Val2</attribute2>
      <znodeval>Value2</znodeval>
  </znode>
   ...
</idoc>

However i wasn't able to get this to work using graphical mapping - from the second occurence of <node> the <znodeval> is not created and Value2 is lost.

Is there a correct way to accomplish this?

Thanks in advance,

Gershon.

Accepted Solutions (1)

Accepted Solutions (1)

former_member187339
Active Contributor
0 Kudos

Hi Gershon,

Seeing your source and target structure it looks like a simple graphical mapping would be enough. Just check whether you have mapped like this:

node-->znode

attribute1--> znode-attribute1

attribute2--> znode-attribute2

node-->znodeval

if this doesn't work try changing the mapping to

node>removecontext>znode

attribute1>splitbyValue> znode-attribute1

attribute2> splitbyValue>znode-attribute2

node>splitbyValue>znodeval

Regards

Suraj

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks alot - the splitByValue solved it.

Best regards,

Gershon