码迷,mamicode.com
首页 > 其他好文 > 详细

LoadRunner 函数之lr_xml_get_values

时间:2016-12-20 20:07:32      阅读:1041      评论:0      收藏:0      [点我收藏+]

标签:get   har   sage   enum   tty   param   技术分享   png   rettype   

技术分享

简单实例如

char *xml_input =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"
  "<S:Body>"
    "<ns2:handleResponse xmlns:ns2=\"http://eaop.gd.chinamobile.com/\">"
      "<return>"
        "<queryecouponsbymobilenumresp>"
          "<msgheader>"
            "<req_seq>20161206165439111</req_seq>"
            "<ope_seq>20161220161336177143</ope_seq>"
            "<retinfo>"
              "<rettype>0</rettype>"
              "<retcode>0</retcode>"
              "<retmsg>success</retmsg>"
            "</retinfo>"
          "</msgheader>"
		  "<msgbody>"
		  "</msgbody>"
        "</queryecouponsbymobilenumresp>"
      "</return>"
    "</ns2:handleResponse>"
  "</S:Body>"
"</S:Envelope>";

Action(){
	lr_save_string(xml_input, "XML_Input_Param"); // Save input as parameter
	// lr_xml_get_values:Retrieves values of XML elements found by a query. 
    lr_xml_get_values("XML={XML_Input_Param}",
          "ValueParam=OutputParam",
          "Query=/Envelope/Body/handleResponse/return/queryecouponsbymobilenumresp/msgheader/retinfo/retcode",
          LAST );
    lr_output_message(lr_eval_string("Query result = {OutputParam}"));
	return 0;
}

输入结果如

技术分享

 

LoadRunner 函数之lr_xml_get_values

标签:get   har   sage   enum   tty   param   技术分享   png   rettype   

原文地址:http://www.cnblogs.com/guanfuchang/p/6203866.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!