Replacing nodes in receive pipeline RRS feed

  • Question

  • Hi guys,

    I'm trying to implement code in my receive pipeline that will replace the value of empty nodes with a pre-set value so for example if an inbound message node has an blank field the pipeline will replace the value of that blank node with 'Dog', I've tried using both the 'Descendants' method with loading the message into an XDocument and tried using XmlDocument but i'm struggling to replace the value, when I tried to use XDocument I could successfully find the empty nodes and remove them using the following:


    I just need to replace the 'Remove();' with a replacing function but XDocument doesn't have a replace method.

    Any ideas would be much appreciated,

    Cheers, Kyle.

    Wednesday, February 20, 2019 5:18 PM

All replies

  • First off, why are you trying to implement that in a pipeline?   The place to implement this sort of logic is in the schema (setting default values on the destination schema) or in a map.

    If you really want to do this, you might want to look at the BRE Pipeline Component, where there are various functions to be able to manipulate both the contents and context of messages.

    Wednesday, February 20, 2019 10:23 PM
  • Pipeline is not the correct place to do so. You pipelines should always be used to implement custom functionalities, eg custom disassembling, custom Validations etc.

    As Colin said, these values should be set in the schemas when you are creating it.

    Can you please explain your requirement which is forcing you to implement this kind of design???

    Mandar Dharmadhikari

    Wednesday, February 20, 2019 10:31 PM
  • In my message when a blank node is sent through my current receive pipeline which is as follows:


    JSON decoder



    XML disassembler







    The output message with no further alterations changes the blank field to \n which makes the output message end up looking like this:



    So the reason I want to do this in the pipeline is find all the blank fields and just change the field data in "" so that the output is like this:


    Thursday, February 21, 2019 9:41 AM
  • How is the empty node with a newline causing an issue? 

    Maybe if you describe that we can help you resolve that.

    Thursday, February 21, 2019 10:59 PM