locked
BizTalk Map: how to avoid generating empty nodes for elements in a choice RRS feed

  • Question

  • Hi,

    I have an XSD (for a XML message) and a map. I want to recopy all items from this message to the exact same XSD structure.

    Because I have several "choices" groups with elements in it, the maps generates empty nodes for all elements in the outgoing message. And the validation fails.

    Because it is not a Flat File Schemas, I can't use the generate empty nodes and/or suppress empty nodes properties of the schemas...

    I know that I can always do that by using XSLT, but is it possible without using XSLT?

    Thanks.

    Thursday, April 14, 2016 4:43 PM

Answers

  • Then a simpler way for you would be to NOT USE Maps for this purpose. Using the source and destination schema generate .Net Classes (xsd.exe /c /l:CS /n:<your target namespace>......) and create a library to replace the MAP. In the library when you serialize/de-serialize the object the other choice nodes will NOT be emitted.

    You would need to replace the transform step in your orchestration (assuming there is one) with a Message Construct shape where you will call the message helper library and complete the Message assignment/construction.

    Regards.

    • Proposed as answer by Angie Xu Monday, April 25, 2016 1:37 AM
    • Marked as answer by Angie Xu Monday, April 25, 2016 1:37 AM
    Friday, April 15, 2016 6:09 AM

All replies

  • U will have to put in blank element chancks for each element map using logical string functoids.

    Or did u try setting the min occurs for elemnets records etc to 0.. That will also take care of the checks .. Try it..

     

    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    Thursday, April 14, 2016 5:13 PM
    Answerer
  • A "choice" element will likely have a "xsi:type" attribute that will let you know the exact choice element. In the map you could examine this element and decide.

    Regards.

    Friday, April 15, 2016 6:00 AM
  • Hi,

    Thanks.

    The 1st solution you proposed is not possible for me because I have about 50+ choices elements in the source message.

    And yes the 2nd solutions worked but requires to update the source schema and unfortunately the source schema comes from the ISO standardisation so it is not a good idea to modify it.

    Friday, April 15, 2016 6:02 AM
  • Hi,

    Not sure to understand what you mean exactly but for sure, what I can't do is to add logical functoids for each choice group in the source schema because I have about 50+ groups like that...

    Friday, April 15, 2016 6:03 AM
  • Then a simpler way for you would be to NOT USE Maps for this purpose. Using the source and destination schema generate .Net Classes (xsd.exe /c /l:CS /n:<your target namespace>......) and create a library to replace the MAP. In the library when you serialize/de-serialize the object the other choice nodes will NOT be emitted.

    You would need to replace the transform step in your orchestration (assuming there is one) with a Message Construct shape where you will call the message helper library and complete the Message assignment/construction.

    Regards.

    • Proposed as answer by Angie Xu Monday, April 25, 2016 1:37 AM
    • Marked as answer by Angie Xu Monday, April 25, 2016 1:37 AM
    Friday, April 15, 2016 6:09 AM
  • DOnt change ur source schema. Make a copy of source and do min occurs to 0. Map ur source to this source copy and then use that message hence forth.

    It may work, give it a try..


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    Sunday, April 17, 2016 10:48 AM
    Answerer