<element xmlns=''> was not expected

by eliasen 9. December 2006 22:24

Hi

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:

DeliveryDate = xpath(OrderMessage, "/*[local-name..........");

and I needed to change it to

DeliveryDate = xpath(OrderMessage, "string(/*[local-name..........)");

Again, something I have done a million times... this time I just forgot it. And honestly, I really don't think the error message gives a very good idea of what is wrong...

Hope this gets indexed and someone later on will find it helpful :-)

--
eliasen

Tags:

BizTalk 2006

Comments (13) -

Eugene Rosenfeld
Eugene Rosenfeld
4/5/2007 10:34:08 PM #

Thanks for a great post! I got this error and could not even guess as to how to start diagnosing it. You saved me hours of work. Thanks again.

-Eugene

Reply

Jan Eliasen
Jan Eliasen
4/6/2007 7:37:50 AM #

Glad I could help! Smile

Reply

Mahmud Akhtar Qureshi
Mahmud Akhtar Qureshi
11/8/2007 8:14:35 PM #

You're a saviour! Thanks for posting the solution on the web!

Reply

Jan Eliasen
Jan Eliasen
11/10/2007 12:44:09 PM #

Anytime Smile

Reply

Zoe Hart
Zoe Hart
11/28/2007 9:09:33 PM #

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?

Thanks

Reply

Jan Eliasen
Jan Eliasen
11/29/2007 8:05:11 PM #

Hi Zoe

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

Anyway, take a look at blog.eliasen.dk/...f3e-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.

Oh yeah, and take a look at http://www.competitive.com/TechnologiesUsed.aspx - why isn't BizTalk mentioned? .-)

--
eliasen

Reply

Roy
Roy
10/24/2008 8:50:30 AM #

Almost 2 years later, you also helped me out with this post Smile

Thanx!

Reply

Jan Eliasen
Jan Eliasen
10/25/2008 3:46:01 PM #

Well, good information never expires! Smile

Glad I could help.

--
eliasen

Reply

Q Ay
Q Ay
10/4/2010 2:42:17 PM #

4 years later, ans still useful ...
But why is it neeeded here and not there ?

Reply

Jan Eliasen
Jan Eliasen
10/4/2010 6:03:22 PM #

Hi Q Ay

Yes, still uefull...

Needed here and not there? Not sure what you mean... it is needed whenever you want to get the value of a node and not the node itself... It should be pretty consistent.

--
eliasen

Reply

Q Ay
Q Ay
10/5/2010 8:09:24 AM #

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!

Reply

Jan Eliasen
Jan Eliasen
10/5/2010 6:58:05 PM #

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...

--
eliasen

Reply

Thanx. You saved me for some useless debug Smile

Reply

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About the author

Jan Eliasen is 37 years old, divorced and has 2 sons, Andreas (July 2004) and Emil (July 2006).

Jan has a masters degree in computer science and is currently employed at Logica Denmark as an IT architect.

Jan is a 6 times Microsoft MVP in BizTalk Server (not currently an MVP) and proud co-author of the BizTalk 2010 Unleashed book.

BizTalk Server 2010 Unleashed


Buy from Amazon

Microsoft MVP


6 times: July 2004, July 2008, July 2009, July 2010, July 2011, and July 2012. Not currently an MVP.

MCTS

Image to show

Month List

Page List