首页 > 其他 > 详细

LoadRunner 函数之lr_xml_get_values

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

技术分享

简单实例如

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!