Don't Forget the XPath string() function

When using the xpath() function in the orchestration designer you may need to obtain the value from a single node (I'm distinguishing between trying to obtain the node vs. the node's value.) If you are attempting to do this, please don't forget to wrap your xpath statement with the xpath string function, for instance:

myStringValue = xpath(myMessage, "string(/*[local-name()='MyElement' and namespace-uri()='']/@*[local-name()='MyAttribute' and namespace-uri()=''])");

If you forget to do this your variable (in this case myStringValue) will have a value of null and depending on your usage of that variable later on in your orchestration you may end up with an exception.

 

Notes:

RecordCount = System.Convert.ToInt32(xpath(GetPIPGENList_ResTmp, "count(/*[local-name()='GetPIPGENList_Response']/*[local-name()='KEY'])"));

 

Ref: Repost - Don't Forget the XPath string() function

posted @ 2008-10-29 00:32  upzone  阅读(213)  评论(0编辑  收藏  举报