Announcement

Collapse
No announcement yet.

Insert XML values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Insert XML values

    <Message>
    <City>
    <City.Name>New York</City.Name>
    </City>
    <house>
    <Kitchen>
    <Kitchen.Sink>1</Kitchen.Sink>
    </Kitchen>
    <Bed>
    <Bed.Lamp>1</Bed.Lamp>
    </Bed>
    </house>
    </Message>



    The message gets batched at the <City> level. I need to copy
    <City>
    <City.Name>New York</City.Name>
    </City>

    into the rest of the XML body, and place it right after </Bed>. The value of the city will be dynamic, as it differes on each message.

    I've tried making a outbound template such as below but does not seem to work:

    tmp['City']['City.Name'] = msg['City']['City.Name'].toString();

    Also tried mapping values from <city></city> but it seems to copy the literal value of the map.

    Any ideas would be appreciated.
    Last edited by gojoshi; 10-02-2019, 04:47 AM.

  • #2
    Not sure if this will always work depending on what your real messages look like, but for this example, you can do:

    Code:
    msg.house.Bed += msg.City

    Comment


    • #3
      Thank You agermano, that does work.

      Comment


      • #4
        If you have no Bed child nodes of house this will append City as the last child node of house.

        If you have more than one Bed child node of house this could potentially reorder child nodes of house (all Bed nodes will be grouped together, a copy of msg.City will be appended, any nodes between your Bed nodes will be moved down after the msg.City copy.)

        If you have no house node this will create one.

        If you have more than one house node it will throw an exception.

        Comment

        Working...
        X