Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Is there a Mapping solution to this problem? › Re: Is there a Mapping solution to this problem?
You can use the map file Map2.btm as below[last]..
Do the following..
1.Create a schemas from ur input xml file given by you.
2.create a map Map2.btm
3.Create a dummy schema as follows
—-Rootnode1
———–Fieldelement[string]
Map the output of scripting functiod to this field element.
4 Create another Map Map3.btm
5.Input schema is the Dummy Schema created above
6.Output Schemas as below
Passenger———Rootnode
—<xs Any element>
Map the field element to the Passenger rootnode…u will get the outputyou mentioned.
you can mail me if still find it difficult…I will mail u the solution.
——————————————–Map2.btm———-
<?xml version="1.0" encoding="utf-16"?>
<!– Generated using BizTalk Mapper on Mon, Jan 22 2007 04:22:19 AM –>
<mapsource Name="BizTalk Map" BizTalkServerMapperTool_Version="2.0" Version="2" XRange="100" YRange="420" OmitXmlDeclaration="Yes" TreatElementsAsRecords="No" OptimizeValueMapping="Yes" GenerateDefaultFixedNodes="Yes" CopyPIs="No" method="xml" xmlVersion="1.0" IgnoreNamespacesForLinks="Yes">
<SrcTree>
<Reference Location=".\StringChar_Input.xsd" />
</SrcTree>
<TrgTree>
<Reference Location=".\Schema2.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()='<Schema>']/*[local-name()='TestInput']/*[local-name()='BreakDown']/*[local-name()='Line']" LinkTo="1" Label="" />
<Link LinkID="2" LinkFrom="1" LinkTo="3" Label="" />
<Link LinkID="3" LinkFrom="3" LinkTo="4" Label="" />
<Link LinkID="4" LinkFrom="1" LinkTo="6" Label="" />
<Link LinkID="5" LinkFrom="6" LinkTo="5" Label="" />
<Link LinkID="6" LinkFrom="1" LinkTo="2" Label="" />
<Link LinkID="7" LinkFrom="4" LinkTo="2" Label="" />
<Link LinkID="8" LinkFrom="5" LinkTo="2" Label="" />
<Link LinkID="9" LinkFrom="2" LinkTo="7" Label="" />
<Link LinkID="10" LinkFrom="7" LinkTo="/*[local-name()='<Schema>']/*[local-name()='PassengerData1']/*[local-name()='Field']" Label="" />
</Links>
<Functoids>
<Functoid FunctoidID="1" X-Cell="53" Y-Cell="215" Functoid-FID="328" Functoid-Name="Cumulative Concatenate" Label="">
<Input-Parameters>
<Parameter Type="Link" Value="1" Guid="{033CA7BF-0B8A-4FF5-AD81-04680F9AC48D}" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="2" X-Cell="57" Y-Cell="215" Functoid-FID="106" Functoid-Name="String Extract" Label="">
<Input-Parameters>
<Parameter Type="Link" Value="6" Guid="{094BEFBA-37BD-44D6-A434-E9857B35A083}" />
<Parameter Type="Link" Value="7" Guid="{0BB8F0D7-08DF-4C23-A9F8-62A51C510258}" />
<Parameter Type="Link" Value="8" Guid="{490276A9-4D39-47B8-9722-0AC5B30E3A32}" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="3" X-Cell="54" Y-Cell="213" Functoid-FID="101" Functoid-Name="String Find" Label="">
<Input-Parameters>
<Parameter Type="Link" Value="2" Guid="{FB3CB398-D84F-4A0C-A0E8-AC296FACF4BF}" />
<Parameter Type="Constant" Value="XT" Guid="{5429782D-3043-45B9-81CD-0B68330F0747}" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="4" X-Cell="56" Y-Cell="213" Functoid-FID="118" Functoid-Name="Addition" Label="">
<Input-Parameters>
<Parameter Type="Link" Value="3" Guid="{0F92C50A-FB69-47CB-B28A-4F381E44B57E}" />
<Parameter Type="Constant" Value="2" Guid="{906BB748-9C48-436B-8F97-C8D214F6A7D7}" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="5" X-Cell="56" Y-Cell="217" Functoid-FID="119" Functoid-Name="Subtraction" Label="">
<Input-Parameters>
<Parameter Type="Link" Value="5" Guid="{8C71F161-B146-4E3D-A316-F9862F6D53A1}" />
<Parameter Type="Constant" Value="1" Guid="{7074AE22-7CA5-4BC1-A0D0-BDB37C44E00E}" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="6" X-Cell="54" Y-Cell="217" Functoid-FID="101" Functoid-Name="String Find" Label="">
<Input-Parameters>
<Parameter Type="Link" Value="4" Guid="{6877A8E0-607B-4B34-9E4C-A7539B0F6728}" />
<Parameter Type="Constant" Value="LAST" Guid="{CCFB44D1-CABE-44CC-ADC9-E305723452DE}" />
</Input-Parameters>
</Functoid>
<Functoid FunctoidID="7" X-Cell="59" Y-Cell="215" Functoid-FID="260" Functoid-Name="Scripting" Label="">
<Input-Parameters>
<Parameter Type="Link" Value="9" Guid="{D367F85B-FE51-43FD-83D3-2ECD1D3F21A2}" />
</Input-Parameters>
<ScripterCode>
<Script Language="CSharp"><![CDATA[///*Uncomment the following code for a sample Inline C# function
//that concatenates two inputs. Change the number of parameters of
//this function to be equal to the number of inputs connected to this functoid.*/
public string MyConcat(string aString)
{
aString = aString.Replace(" ","");
int i = 2 ;
int intIndex = 0;
int intstrCode=0;
int IntPreva2Index=0;
string strcode;
string strnumber;
string strnumberDec;
string strnumberFinal;
string strFinalOutput="<Taxes>";
int a2LastIndex = 0;
do
{
int a2 = aString.IndexOf(".",intIndex);
if (aString.Length – a2LastIndex == 5)
{
i = 3;
}
else
{
strnumberDec = aString.Substring(a2 + 1, 2);
strnumber = aString.Substring(intstrCode, a2 – IntPreva2Index);
strnumberFinal = strnumber + "." + strnumberDec;
strcode = aString.Substring(a2 + 3, 2);
intstrCode = aString.IndexOf(strcode) + 2;
IntPreva2Index = a2 + 5;
intIndex = a2 + 1;
strFinalOutput = strFinalOutput + "<Data><Code>" + strcode + "</Code><Value>" + strnumberFinal + "</Value>";
}
a2LastIndex = a2;
} while (i == 2);
strFinalOutput=strFinalOutput+" </Taxes>";
return strFinalOutput;
}]]></Script>
</ScripterCode>
</Functoid>
</Functoids>
</Page>
</Pages>
</mapsource>
—————————————————-