adding CRLF to output XML file

Home Page Forums BizTalk 2004 – BizTalk 2010 adding CRLF to output XML file

Viewing 2 reply threads
  • Author
    Posts
    • #24337

      Hello Gurus,

      this is maybe a noobish question, but I can’t find a solution anywhere.

      I’m creating a XML-output file. As usual, there are no delimiters between the tags. So the file is not readable with a simple textviewer (like notepad). But one of our customers needs this delimiters to process the XML.

      Is there any parameter or work around to insert delimiters (crlf) to the output XML-file? I’m using BizTalk Server 2006 R2 on a Windows 2003 Server x64.

      Thx for help in advance.

    • #24338

      I haven’t tried this, but my assumption is:

       XML, by nature is a completely based on tags and thats exactly how your output is being produced. XML parser doesn’t consider those characters. However I assume you should be allowed to add new line characters by reading/writing  XML file as textfile and add those characters in the pipeline.

    • #24341

      Hi,

       

         You will have to create a custom component (to insert such delimiters after your XML tags in your message) and GAC it. Then, create a Send pipeline in VS project, add your custom component to the BizTalk Pipeline Components folder in the Toolbox area, drag and drop your custom component to the Pre-assemble stage in the Pipeline Designer view, and drag and drop the XML assembler to the Assemble stage (keeping its default settings for properties). The reason why you reference the component in the Pre-assemble stage is because you want to process the message before it gets serialized in the Assemble stage.

         Once you have compiled and deployed your Send pipeline, use that as your Send Pipeline when configuing your port’s properties in the Administration Console.

         You can refer to this MSDN article to give you an idea on how to develop such a component:

      http://msdn.microsoft.com/en-us/library/aa561772(BTS.20).aspx

         Also, here are a couple of blogs that detail how to develop custom components for pipelines:

      http://blogs.msdn.com/brajens/archive/2006/11/25/how-to-develop-biztalk-custom-pipeline-components-part1.aspx

      http://blogs.tallan.com/biztalk/2006/11/21/custom-pipeline-components-part-1-getting-started/

       

         Hope this helps!

       

          Daniel.

       

      • #24343

        If you use a map to create the output message you can set the <xsl:output> attribute indent to yes.
        If using a Biztalk map open the map, click on the grid and set the Indent property to Yes.
        If using custom Xslt add indent=”yes” to the <xsl:output> node

        • #24348

          Thx Greg,

          that works. [:D] The output file is generated with crlf.

          But by testing the map I get some errors like:

          “Output validation error: the element should not contain spaces. The contentmodell is empty.”

          It’s a translation of the german error message, so maybe not exact. Any comments or can I ignore this messages?

          • #24350

            The test map function is reporting that the output does not strictly match the schema. At runtime there is no validation of the map output, unless you explicitly code a schema validation or use one of the validating pipeline components.
            The key question is does the map output match what your customer is expecting. If the answer is yes, then you have two options:
            1. Ignore this error (you can even turn off output validation in the map properties so you never see this error)
            2. Modify the schema to allow whitespace. This normally happens on records that contain no elements, just attributes. You can select these records and set  Mixed = true

Viewing 2 reply threads
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.