XML Declaration


  • Hi,


    I have a question regarding the standard XML Assembler.
    I have this in my outgoing XML : <?xml version='1.0' encoding='UTF-8'>
    But I need to strip off the XML declaration, so I changed the setting in my PipelineComponent (Add XML Declaration) to false. And as requested it strips off that <?xml version='1.0' encoding='UTF-8'>.

     The question now is if there is a possibility to keep the XML Declaration but only strip off the enconding part of the XML Declaration? So I have something like this <?xml version='1.0' >.



    Glenn Colpaert - MCTS BizTalk Server - Blog :
    Tuesday, January 24, 2012 10:06 AM


All replies

  • You could make a custom pipeline component and implement it on the send pipeline after the assembler stage and have it replace the encoding with nothing using regular expressions:


    Search: (?<=\<\?xml version="1.0" )encoding="UTF-8"( )?(?=\?\>)

    Replace: (Empty String)

    Note: It should only replace UTF-8 instances since UTF-8 is the default encoding and all other encodings should be specified

    Morten la Cour

    • Proposed as answer by Shay Feldman Tuesday, January 24, 2012 10:25 AM
    • Marked as answer by GlennColpaertMVP Thursday, January 26, 2012 7:38 AM
    Tuesday, January 24, 2012 10:19 AM
  • It can be done easily with Symbol preprocessor pipeline component (See MSDN) 

    make sure your RegEx (or several simple replaced string) covers all possible variations of the declaration. 

    Leonid Ganeline [BizTalk MVP] BizTalk and 0MQ (ZeroMQ)

    Tuesday, January 24, 2012 4:48 PM
  • Thx for clearing this out.
    If there is no standard way of getting only the prolog, a custom pipelinecomponent will do...

    Glenn Colpaert - MCTS BizTalk Server - Blog :
    Thursday, January 26, 2012 7:38 AM