Home Page › Forums › BizTalk 2004 – BizTalk 2010 › File Splitter › Re: File Splitter
Hi,
Let’s say your X12 message has the following XML contents (I’m taking the example of an X12 format of transaction type 271 and showing just a snippet of it), let’s call it mX12:
<gen0:X12_00401_271 xmlns:gen0=”http://schemas.microsoft.com/BizTalk/EDI/X12/2006″><ST><ST01>271</ST01><ST02>ST02</ST02></ST>
… </gen0:X12_00401_271>
Now, let’s say you just want to extract the ST node and put that into your output message mOut. First of all, in your orchestration, declare a String variable vXPath and a variable vXmlDocument of type System.Xml.XmlDocument, and define a Scope shape of transaction type Atomic. In your scope shape, define two variables of type System.Xml.XmlNode and System.Xml.XmlNodeList, let’s call them vXmlNode and vXmlNodeList.
Then, in your scope shape, define an Expression shape and put the following code in it:
vXPath = “/*[local-name()=’X12_00401_271′ and namespace-uri()=’http://schemas.microsoft.com/BizTalk/EDI/X12/2006′%5D/*%5Blocal-name()=’ST’ and namespace-uri()=”]”;
vXmlNodeList = xpath(mX12, vXPath);
vXmlNode = vXmlNodeList.Item(0);
vXmlDocument.LoadXml(“<ns0:YourSchemaName xmlns:ns0=” + System.Char.ToString(‘”‘) + “http://YourSchemaNamespace” + System.Char.ToString(‘”‘) + “>” + vXmlNode.InnerText + “</ns0:YourSchemaName>”;
mOut = vXmlDocument;
And you would follow the same pattern for your other output message.
I hope this is enough information to get you going.
Daniel.