locked
Concatenate repeating node values using xpath RRS feed

  • Question

  • Friends,

    i have a record which is repeating and there is a field inside the record.

    i want the concatenated values of all the occurrences of this filed into a string variable in orchestration. (I use this to populate in BAM tracking using BAM API)

    xpath 1.0 doesn't have the required method it seems.

    Any other work around please?


    Please mark the post as answer if this answers your question. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

    Monday, December 7, 2015 11:56 AM

Answers

  • A helper to which you'd pass the Message and the root. Then in the helper you can extract the XML using the XLANGMessage[0].RetrieveAs(typeof(System.Xml.XmlDocument)). After this using the XPATH you can use the XmlDocument.SelectNode method to get a NodeList and using a StringBuilder create the appended string which this helper can return.

    Regards.

    • Marked as answer by Ravindar Thati Wednesday, December 9, 2015 4:09 AM
    Monday, December 7, 2015 11:59 AM
  • Hi Ravindar ,

    This can be easily accomplished using .Net Code were you can pass the message as xmldocument  to the C# library and get the node value with Nodelist.

    Something like below

      XmlNodeList nodeList;
        XmlNode root = doc.DocumentElement;
    
        nodeList=root.SelectNodes("descendant::book[author/last-name='Austen']");
     

    Thanks

    Abhishek


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    • Marked as answer by Ravindar Thati Wednesday, December 9, 2015 4:09 AM
    Monday, December 7, 2015 12:31 PM

All replies

  • A helper to which you'd pass the Message and the root. Then in the helper you can extract the XML using the XLANGMessage[0].RetrieveAs(typeof(System.Xml.XmlDocument)). After this using the XPATH you can use the XmlDocument.SelectNode method to get a NodeList and using a StringBuilder create the appended string which this helper can return.

    Regards.

    • Marked as answer by Ravindar Thati Wednesday, December 9, 2015 4:09 AM
    Monday, December 7, 2015 11:59 AM
  • Hi Ravindar ,

    This can be easily accomplished using .Net Code were you can pass the message as xmldocument  to the C# library and get the node value with Nodelist.

    Something like below

      XmlNodeList nodeList;
        XmlNode root = doc.DocumentElement;
    
        nodeList=root.SelectNodes("descendant::book[author/last-name='Austen']");
     

    Thanks

    Abhishek


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    • Marked as answer by Ravindar Thati Wednesday, December 9, 2015 4:09 AM
    Monday, December 7, 2015 12:31 PM