Reading text value from node using XPath function directly in BizTalk orchestrations · Gobbledygooks by @riha78

A random pile of .NET, BizTalk and integration focused scribbles by @riha78.

A bit more about me and a few projects I am currently spending time on.

Reading text value from node using XPath function directly in BizTalk orchestrations

   

The XPath function that's available directly inside BizTalk orchestration is a powerful little tool. However I've seen a couple of project where developers just grown tired of it and started creating their own little libraries instead. I'll be the first to admit that the XPath function isn't perfect, and it sure doesn't work like most of the other XPath engines (which is the biggest problem) but it's still inside the orchestration and you can use it to both read and assign values to a message which is super useful! Basically I don't see a valid reason for bringing more complexity into your solution by adding another library - as long as you're just going to read or set value using XPath.

However there is one trick that you should know of when it comes to reading a text value from a node. Basically you have to use both the string() and
text() XPath functions. Both Charles Young and Yossi Dahan has good post on this subject. Also if your new to writing XPath expressions for complex schemas with loads of namespaces and stuff (like schemas in BizTalk) this post could be useful for you.

Finally a nice tool for writing and testing small XPath expression inside Visual Studio (if you don't want to spend x minutes waiting for XmlSpy to start up ...) is XPathmania. Read about it here - I use it all the time!

Comments