Flattening repeating structure in biztalk

2019-09-01 04:21发布

I´ve an xml instance similar to this:

<outerElementList>
    <outerElement>
        <outerID>1</outerID>
        <innerElementList>
            <innerElement>
                <innerID>10</innerID>
            </innerElement>
            <innerElement>
                <innerID>20</innerID>
            </innerElement>
        </innerElementList>
    </outerElement>
    <outerElement>
        <outerID>2</outerID>
        <innerElementList>
            <innerElement>
                <innerID>30</innerID>
            </innerElement>
            <innerElement>
                <innerID>40</innerID>
            </innerElement>
        </innerElementList>
    </outerElement>
</outerElementList>

And I need to end up with this structure:

<ElementList>
    <Element>
        <ID>1</ID>  
    </Element>
    <Element>
        <ID>2</ID>  
    </Element>
    <Element>
        <ID>10</ID> 
    </Element>
    <Element>
        <ID>20</ID> 
    </Element>
    <Element>
        <ID>30</ID> 
    </Element>
    <Element>
        <ID>40</ID> 
    </Element>
</ElementList>

I realize that I need to use a looping functoid, but I just cant seem to get it right.

Also does anyone know of a good tutorial to do these maps i C#?

标签: c# maps BizTalk
1条回答
乱世女痞
2楼-- · 2019-09-01 04:39

You'll want to map it like this:

Biztalk map

Using this input:

<ns0:outerElementList xmlns:ns0="http://BizTalk_Server_Project1.Schema1">
  <outerElement>
    <outerID>1</outerID>
    <innerElementList>
      <innerElement>
        <innerID>10</innerID>
      </innerElement>
      <innerElement>
        <innerID>20</innerID>
      </innerElement>
    </innerElementList>
  </outerElement>
  <outerElement>
    <outerID>2</outerID>
    <innerElementList>
      <innerElement>
        <innerID>30</innerID>
      </innerElement>
      <innerElement>
        <innerID>40</innerID>
      </innerElement>
    </innerElementList>
 </outerElement>
</ns0:outerElementList>

I got this output:

<ns0:ElementList xmlns:ns0="http://BizTalk_Server_Project1.Schema2">
  <Element>
    <ID>1</ID>
  </Element>
  <Element>
    <ID>2</ID>
  </Element>
  <Element>
    <ID>10</ID>
  </Element>
  <Element>
    <ID>20</ID>
  </Element>
  <Element>
    <ID>30</ID>
  </Element>
  <Element>
    <ID>40</ID>
  </Element>
</ns0:ElementList>
查看更多
登录 后发表回答