Home Page › Forums › BizTalk 2004 – BizTalk 2010 › xPath error
- This topic has 4 replies, 1 voice, and was last updated 6 years, 11 months ago by
community-content.
-
AuthorPosts
-
-
March 21, 2006 at 12:57 AM #13202
If you open the schema inside BizTalk and click on the Body node, it will give you the full xpath expression inside the Node Xpath property (something named like that). That’s what I usually use.
Also, I sometimes build a simple .net app to test my xpath queries. That saves a lot of time as well.
-
March 21, 2006 at 2:47 AM #13203
Also the context-position is 1- based
So you should have something like this:[code:1:51ddb39d9a]/*[local-name()=’Sample’ and namespace-uri()=’http://BizTalkOrch.InPutSchema’]/*[local-name()=’Body’ and position()=1 and namespace-uri()=”][/code:1:51ddb39d9a]
-
March 23, 2006 at 7:41 PM #13204
The error is from StringBuilder not from the xpath function.
I would suggest removing the System.String.Format and just assigning the string to XPathStatement.Also the position() function is case sensitive.
-
March 19, 2006 at 6:23 AM #13205
I have the following xml:
[color=blue:67475ee949]<ns0:Sample xmlns:ns0=\”http://BizTalkOrch.InPutSchema\”>
<Body>
<AnyThing>AnyThing_0</AnyThing>
</Body>
</ns0:Sample>[/color:67475ee949]This message is assigned to message variable InMsg.
I have a variable called xmlDoc of type System.xml.xmldocument
I have another message of type System.xml.xmldocument called OutMsgI am using xPath to extract some of InMsg message details:
my xpath expression is:[color=darkred:67475ee949]xDoc = new System.Xml.XmlDocument();
xDoc= xpath(InMsg, \”//*[local-name()=’Body’][0]\”);
OutMsg=xDoc;[/color:67475ee949]When I execute this and check it the Debug mode tracked events:
I get the following error:
[color=red:67475ee949]Microsoft.XLANGs.Core.NullPartException: The part ‘part’ of message ‘OutMsg’ contained a null value at the end of the construct block[/color:67475ee949].
at Microsoft.XLANGs.Core.Part.ConstructionCompleteEvent()
at Microsoft.XLANGs.Core.XMessage.ConstructionCompleteEvent()
at BizTalkOrch1.XPath.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Microsoft.XLANGs.Core.NullPartException
Scoped@
XPath.XPath
9363d962-4b5b-4fda-b012-74d2e73cf154I feel something is wrong in my xPath statment. Please help If you can suggest some thing better.
-
March 23, 2006 at 1:11 PM #13206
Thanks for your advice:
Now I have changed it to[color=blue:f19eb68538]XPathStatement = System.String.Format(\”/*[local-name()=’Sample’ and namespace-uri()=’http://BizTalkOrch.InPutSchema’%5D/*%5Blocal-name()=’Body’ and Position()=1 and namespace-uri()=”]\”);
xDoc = xpath(InMsg, XPathStatement);[/color:f19eb68538]But Now I am getting the following error:
[color=red:f19eb68538]System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at BizTalkOrch1.XPath.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
System.FormatException
Scoped@
XPath.XPath
ea9527c1-8a78-47d6-ad83-3f8e058936a7[/color:f19eb68538]Please note that I have tried with both position 0 as well as 1 but the error remain the same.
regards,
-
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.