Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Debatching
- This topic has 4 replies, 1 voice, and was last updated 9 years, 3 months ago by
community-content.
-
AuthorPosts
-
-
September 3, 2008 at 11:06 PM #20567
I have the following xmlmessage I am trying to debatch
<tasks xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns=”http://iTask/task.xsd“>
<task>
<ownerid>Premier</ownerid>
<taskid>4004</taskid> </task>
<task>
<ownerid>Premier</ownerid>
<taskid>5000</taskid>
</task>
</tasks>When I write the following:
iRecordCount = System.Convert.ToInt32(xpath(xmlmessage, “count(/*[local-name()=’tasks’ and namespace-uri()=’http://iTask/task.xsd’%5D/*%5Blocal-name()=’task’ and namespace-uri()=’http://iTask/task.xsd’%5D)”));
iRecordCount gets a 0.
I thing the problem is with the XPath. Please help.
-
September 4, 2008 at 1:37 AM #20568
Wonder (?!?),
It looks as though your XPath is incorrect; I’ve just knocked up a quick schema that looks like the one above and I came out with the following XPath:
count(/*[local-name()=’tasks’ and namespace-uri()=’http://iTask/task.xsd’%5D/*%5Blocal-name()=’task’ and namespace-uri()=”])
Notice that the ‘task’ element doesn’t have a namespace-uri (I’m presuming here that your schema has the Element FormDefault setting set to ‘Default’, which is unqualified) – I think this is where you are going wrong.
HTH, Nick.
-
September 4, 2008 at 5:15 AM #20571
Also, here is a good tool for testing XPath: http://www.bizbert.com/bizbert/CommentView,guid,b3765922-23df-4db8-8b16-2c340873b4c9.aspx#commentstart. It will make your life way easier to get your XPath working in the tool before trying it out in a BizTalk app.
-
September 5, 2008 at 1:47 AM #20598
thank you. I tested Nicks solution with that tool. We will be using it from now on.
-
-
September 5, 2008 at 1:45 AM #20597
Thank you.
your solution works. I needed this so I can debatch the xmlmessage in the biztalk orchestration.
I am still new to biztalk.
Thank for the help
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.