I ran into this issue today. It turned out that the error occured in an expression shape that used xpath to get a value from a message into a variable.

Having been using xpath expressions inside my orchestrations for a long time, I am really not used to having them fail on me And this particular xpath expression was copied from the "Instance XPath" property of the element in the schema editor. So it shouldn't fail. I did add a "[1]" to the xpath because I needed to access the first element of a re-occuring element, but still - not something I hadn't done plenty of times before.

Actually, it took quite some time before I discovered what was wrong. My expression was:

I'm getting this error but I'm not trying to assign the xpath result to a string. I'm trying to assign it to a BizTalk message variable. If the xpath expression returns a single XmlElement (and its child elements), isn't that a valid result to assign to a message? If not, how do I get my message to contain the XML returned from the xpath expression?

So, I might even be able to help you outside the newsgroups this time? :-)

Anyway, take a look at http://blog.eliasen.dk/PermaLink,guid,6c7ac8ec-3f3e-49e4-a15a-76c736d30654.aspx - I am actually doing what you want to do, I think. See if there is any difference. If all fails, email me your project and I will look at it.

This one for instance, and many others as I have been working from time to time with BTS since 2004, works perfectly (get name from a SharePoint list):data = xpath(GetListItemsResponse, "//*[local-name()='data']/*[local-name()='row'][1]/@ows_Name");

With this one I spent about one full day, and some hairs and neurons, before I added the "string()" function:v1 = xpath(In, "string(/*[local-name()='messageX']/*[local-name()='attachment'][1]/*[local-name()='title'])");

Note both data and v1 are defined as strings, GetListItemResponse and In as schema-based messsages.

Another blog related to the same error ("<element xmlns=''> was not expected") solved it using the /text() xpath function:.../*[local-name()='title']/text()but this did not worked for me.

Anyway the most important is it works, thanks for all Eliasen!

Q Ay

Tuesday, 05 October 2010 20:58:05 (Romance Daylight Time, UTC+02:00)

Hi Q Ay

Well, it appears to me that for attributes you don't need the string function, but for elements you need it. Haven't tested...