BizTalk Gurus

Read Attribute values using XPath or Other alternative

rated by 0 users
Not Answered This post has 0 verified answers | 1 Reply | 2 Followers

Top 50 Contributor
35 Posts
dhavalmistry posted on Sun, Jun 28 2009 12:49 AM

Hi,

I need to read from xml during transformation . based on some parameter i need to identify sending location. Following is my xml and XML is generatin from database (SQL Server 2005)

- <ns0:BOAArlineItem xmlns:ns0="http://BOAArlineItem">
  <ns0:dbo.BELB_History recordbatchnumber="recordbatchnumber_0" RecordLockboxnumber="RecordLockboxnumber_1" contechdepositdate="contechdepositdate_2" EXPORTRECORDLINE="EXPORTRECORDLINE_3" />
  <ns0:dbo.BELB_History recordbatchnumber="recordbatchnumber_0" RecordLockboxnumber="RecordLockboxnumber_1" contechdepositdate="contechdepositdate_2" EXPORTRECORDLINE="EXPORTRECORDLINE_3" />
  <ns0:dbo.BELB_History recordbatchnumber="recordbatchnumber_0" RecordLockboxnumber="RecordLockboxnumber_1" contechdepositdate="contechdepositdate_2" EXPORTRECORDLINE="EXPORTRECORDLINE_3" />
  </ns0:BOAArlineItem>

Attributes recordbatchnumber, RecordLockboxnumber and contechdepositdate value would be same in all the record in file

Now I need to read those attribute value and generate sending file name.

I have used xPath to read attribute values from xml.  following is the code for reading attribute using xpath

//Get the path of the the first HeaderInfo Element
HeaderInfoPath = System.String.Format("//dbo.BankExternalLockBox_History[{0}]",1);
XmlDoc = xpath(BOAArlineItemMSG,HeaderInfoPath);

//Construct Message
XmlDocMSG = XmlDoc;

LockBoxNo = xpath(XmlDocMSG,"string(/dbo.BankExternalLockBox_History/RecordLockboxnumber)");
BatchNo = xpath(XmlDocMSG,"string(/dbo.BankExternalLockBox_History/recordbatchnumber)");

SendFileName = LockBoxNo + BatchNo + System.DateTime.Now.Date.ToString() + ".txt";

OUTBOAArlineMSG(FILE.ReceivedFileName) = SendFileName; 

Can anyone suggest how to use xPath within orchestration or suggest other alternative?

Thanks for early response.

Regards,

- Dhaval M.

 

All Replies

Top 10 Contributor
877 Posts

I would tend to extract the LockBoxNo and BatchNo from the

 

Page 1 of 1 (2 items) | RSS