Adam Zastawski

My Personal Blog

Xpath Expressions for Processing Instructions

Posted by Adam

I use updategrams to send data to SQL Server from Biztalk 2004. Well, I am still battling with how to get meaningful error information when using a scope and an exception handler in my orchestration. (I have found numerous resources on this but I am still not able to accomplish it, see links below.)
I found that I also needed to know how to get information from processing variables when working with K2.Net 2003 workflow engine and BizTalk. I decided to try to get meaningful error information from the processing instructions in this message from the SQL Adapter.

<?xml version="1.0" encoding="UTF-8"?>
<Root xmlns:ns00="urn:schemas-microsoft-com:xml-updategram">
<?MSSQLError HResult="0x80040e2f" Source="Microsoft OLE DB Provider for SQL Server" Description="Violation of PRIMARY KEY constraint 'PK_CONT_Contract'. Cannot insert duplicate key in object 'CONT_Contract'."?>
</Root>

Get the XPATH expression to the node you want first, then use the “processing-instruction()” function to get the processing instruction node.
string(/*[local-name()='Root']/processing-instruction('MSSQLError'))

I found the "processing-instruction()" function in my XSLT/XPATH reference and after a little tinkering I got the previous expression to work. It gets the entire instruction as a string. I will eventually attempt to get the attributes, but for now I need it all so I will cross that bridge later. I tried a few things like: ".../@*[local-name()=’Description’]” but no joy...

http://bloggingabout.net/blogs/wellink/search.aspx?q=Exception&p=1

http://dallas.sark.com/SarkBlog/mholdorf/archive/2004/10/22/442.aspx (Part 1)
http://dallas.sark.com/SarkBlog/mholdorf/archive/0001/01/01/721.aspx (Part 2)

http://weblogs.asp.net/jan/archive/2004/03/22/93981.aspx

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 10/15/2006 at 2:47 AM
Categories: BizTalk | K2.Net 2003
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Wednesday, July 23, 2008 1:09 PM