Regarding Merging XML Files. RRS feed

  • Question

  • HI , 

    I have a requirement where I have to merge the XML files after the mapping  in a loop. ( In orchestration) 

    I am doing that in a class library using Dataset to merge XML.  It was having some performance issues so I switched to the below code which is very fast.

                    XDocument xFileRoot = XDocument.Parse(Doc1.OuterXml);
                    XDocument xFileChild = XDocument.Parse(Doc2.OuterXml);


    However after merging around 10 files,  my output file is having addional CRLF  in between the blank element which was not there incase of using dataset for merging the files. Is there anyway to handle this ? 


    Thanks, Varun

    Friday, March 10, 2017 2:24 PM


All replies

  • Have you had a look at https://support.microsoft.com/en-us/help/2786241/change-in-default-whitespace-behavior-in-biztalk ? There was a change in the way BizTalk handles whitespaces and what you're seeing is the default behavior. You can remove whitespaces using the steps outlined in the article.

    If however you're handling XML in .Net code then refer https://msdn.microsoft.com/en-us/library/aa468566.aspx where you'll need to deal with XML through XMLReader/XMLWriter to avail of the features to address whitespace handling.

    On a complete side note however, if the destination system is working with XML then you should not be bothered about whitespace in the emitted file. XML Readers/Writers will be able to deal with the XML Whitespace properly.


    • Marked as answer by Varun Juneja Monday, March 13, 2017 1:47 PM
    Monday, March 13, 2017 4:31 AM
  • Thanks Shanky.

    you are correct, thought i got to know this that day itself but very much appreciated for your response :)

    Thanks, Varun

    Monday, March 13, 2017 1:48 PM