views:

213

answers:

1

source XSD structure:

   documents (min occurs 1, max occurs 1)
      document (min occurs 1, max occurs unbounded)
         filename (min occurs 1, max occurs 1)

destination XSD structure:

documents (min occurs 1, max occurs 1)
      filename (min occurs 1, max occurs unbounded)

How can this be done in the BizTalk mapper ?

(edit): The 1st provided solution was my first implementation, but it seems that the Test Map option(right-mouse on the BizTalk map .btm file) in BizTalk sometimes needs an extra compile (I only saved the map and then I tested the map with the Test Map option). Now it works.

A: 

In Biztalk 2009 (and presumably also 2006) just connect the "filename" nodes.

Source schema:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://source" targetNamespace="http://source" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
 <xs:element name="documents">
   <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="unbounded" name="document">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="1" maxOccurs="1" name="filename" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Destination schema:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://destination" targetNamespace="http://destination" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  <xs:element name="documents">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="unbounded" name="filename" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Map:

<?xml version="1.0" encoding="utf-16"?>
<mapsource Name="BizTalk Map" BizTalkServerMapperTool_Version="2.0" Version="2" XRange="100" YRange="420" OmitXmlDeclaration="Yes" TreatElementsAsRecords="No" OptimizeValueMapping="Yes" GenerateDefaultFixedNodes="Yes" PreserveSequenceOrder="No" CopyPIs="No" method="xml" xmlVersion="1.0" IgnoreNamespacesForLinks="Yes">
<SrcTree>
  <Reference Location="source.xsd" />
</SrcTree>
<TrgTree>
  <Reference Location="destination.xsd" />
</TrgTree>
<ScriptTypePrecedence>
  <CSharp Enabled="Yes" />
  <ExternalAssembly Enabled="Yes" />
  <VbNet Enabled="Yes" />
  <JScript Enabled="Yes" />
  <XsltCallTemplate Enabled="Yes" />
  <Xslt Enabled="Yes" />
</ScriptTypePrecedence>
<TreeValues>
  <TestValues />
  <ConstantValues />
</TreeValues>
<Pages>
  <Page Name="Page 1">
    <Links>
      <Link LinkID="1" LinkFrom="/*[local-name()='&lt;Schema&gt;']/*[local-name()='documents']/*[local-name()='document']/*[local-name()='filename']" LinkTo="/*[local-name()='&lt;Schema&gt;']/*[local-name()='documents']/*[local-name()='filename']" Label="" />
    </Links>
    <Functoids />
  </Page>
</Pages>

Filburt

related questions