Answered by:
How I can get the value from field in schema by XPATH

Question
-
I am using WCF Test Client, and I am trying to start a wcf Service by Orchestra in Biztalk. In the Orchestra I want to get a value from field in schema by XPATH. but I could not to do it
myPath = @"/*[local-name()='ApplicableChargeResponse' and namespace-uri()='http://xxxxx/xxxxxdtransfer']/*[local-name()='ApplicableChargeResult' and namespace-uri()='http://xxx/xxx]";
myValue = xpath(MsgApplicableChargeDetailsResponce, myPath);
Thank you
Tuesday, February 28, 2012 11:12 AM
Answers
-
Can you check the MinOccurs and MaxOccurs of the Node "ApplicableChangeResponse" it should be MinOccurs=1 and MinOccurs=1
Raj, http://rajwebjunky.blogspot.com
- Marked as answer by Lloyd ZhangModerator Tuesday, March 6, 2012 2:06 AM
Tuesday, February 28, 2012 12:22 PM
All replies
-
Hi Yonial,
Hope you got the below xpath using instentXpath from your xsd schema.
myPath = @"string("/*[local-name()='ApplicableChargeResponse' and namespace-uri()='http://xxxxx/xxxxxdtransfer']/*[local-name()='ApplicableChargeResult' and namespace-uri()='http://xxx/xxx]");
myValue = xpath(MsgApplicableChargeDetailsResponce, myPath);
___________________________________________________________
If this is helpful or answers your question - please mark as answer and vote as helpful.Raj, http://rajwebjunky.blogspot.com
- Proposed as answer by rajwebjunky Tuesday, February 28, 2012 2:55 PM
Tuesday, February 28, 2012 11:18 AM -
myValue is Integer.
I tied like this:
myPath = @"/*[local-name()='ApplicableChargeResponse' and namespace-uri()='http://xx/xx]/*[local-name()='ApplicableChargeResult' and namespace-uri()='http://xx/xx]";
myValue = System.Convert.ToInt32(xpath(MsgApplicableChargeDetailsResponce, myPath));
and I get this ERROR:
Unable to cast object of type 'ArrayBasedXmlNodeList' to type 'System.IConvertible'.
Tuesday, February 28, 2012 11:48 AM -
is this multiple node element ? if Yes then you need decide which row value need to find it.
You can try with [n] at the end of the xpath. here n represents the row number
myPath = @"/*[local-name()='ApplicableChargeResponse' and namespace-uri()='http://xx/xx]/*[local-name()='ApplicableChargeResult' and namespace-uri()='http://xx/xx][0]"
___________________________________________________________
If this is helpful or answers your question - please mark as answer and vote as helpful.Raj, http://rajwebjunky.blogspot.com
- Proposed as answer by Shay Feldman Tuesday, February 28, 2012 12:06 PM
Tuesday, February 28, 2012 11:58 AM -
Hi,
You need to specify which node in nodelist you are interested in.
Please refer to links below,
http://stackoverflow.com/questions/1006283/xpath-select-first-element-with-a-specific-attribute
I hope this helps you.
Thanks With Regards,
Shailesh Kawade
MCTS BizTalk Server
Please Mark This As Answer If This Helps You.
http://shaileshbiztalk.blogspot.com/- Edited by Shailesh Kawade Tuesday, February 28, 2012 12:07 PM
- Proposed as answer by Shailesh Kawade Tuesday, February 28, 2012 12:08 PM
Tuesday, February 28, 2012 11:59 AM -
I Dont think that is this multiple node element, because I have only one element.
In the next picture below, I show you my schema
- Edited by YoniAL Tuesday, February 28, 2012 12:11 PM
Tuesday, February 28, 2012 12:09 PM -
Hi,
You can test your xpath with some tool,
you can try this, http://www.xpathtester.com/ You just need to specify the xml and xpath.
That way you will get to know what are the value or nodelist you are getting back from xpath.
Thanks With Regards,
Shailesh Kawade
MCTS BizTalk Server
Please Mark This As Answer If This Helps You.
http://shaileshbiztalk.blogspot.com/Tuesday, February 28, 2012 12:18 PM -
Can you check the MinOccurs and MaxOccurs of the Node "ApplicableChangeResponse" it should be MinOccurs=1 and MinOccurs=1
Raj, http://rajwebjunky.blogspot.com
- Marked as answer by Lloyd ZhangModerator Tuesday, March 6, 2012 2:06 AM
Tuesday, February 28, 2012 12:22 PM -
Thank you, Your answer was the true..
I learneda new thing,I did not realizeI hadmarked "MinOccurs=1"
Tuesday, February 28, 2012 12:31 PM -
Thank you, Your answer was the true..
I learneda new thing,I did not realizeI hadmarked "MinOccurs=1"
Tuesday, February 28, 2012 12:32 PM -
That sounds gr8.
___________________________________________________________
If this is helpful or answers your question - please mark as answer and vote as helpful.
Raj, http://rajwebjunky.blogspot.com
Tuesday, February 28, 2012 1:05 PM -
Hi YoniAL
It seems you have found your answer, However I would like to suggest you a very good technet wiki "BizTalk Orchestrations XPath: Survival Guide" . Please have a look, It might help you in future.
HTH,Thanks, Naushad (MCC/MCTS) http://alamnaushad.wordpress.com,My New Technet Wiki Article “BizTalk Server: Performance Tuning & Optimization"
If this is helpful or answers your question - please mark accordingly! Please "Vote As Helpful" if this was useful while resolving your question!
Tuesday, February 28, 2012 2:39 PMModerator