Hi All,
I used Web Service Protocol in my script and added the XML script before Action(). Following is my script:
#include "as_web.h"
char *xml_input=
"<MySchool>"
"<teacher>"
"<name>"
"<firstname>MyTeacher</firstname>"
"<lastname>Gauda</lastname>"
"</name>"
"<address>"
"<street>101 South Street</street>"
"<city>Dehradun</city>"
"<email>saranya.rajaram@abc.com</email>"
"<phone>8015499</phone>"
"</address>"
"</teacher>"
"<student>"
"<name>"
"<firstname>Tinku</firstname>"
"<lastname>Raja</lastname>"
"</name>"
"<address>"
"<street>102 North Street</street>"
"<city> Bangalore </city>"
"<email>tinku.raja@xyz.com</email>"
"<phone>8015498</phone>"
"</address>"
"</student>"
"</MySchool>";
Action()
{
/* Query 3: Find the city name of the person whose phone number is 8015498 */
lr_xml_get_values("XML={XML_Input_Param}",
"ValueParam=Result",
"Query=/MySchool/*/address[phone=\"8015498\"]/city",
LAST );
lr_output_message("City of the person having phone number 8015498: %s", lr_eval_string("{Result}"));
* In the above, since city is at the same level as phone, so it worked.
/* Query 2: Find the firstname of the person whose phone number is 8015498 */
lr_xml_get_values("XML={XML_Input_Param}",
"ValueParam=Result",
"Query=/MySchool/*/address[phone=\"8015498\"]/?",
LAST );
lr_output_message("First name of person having phone number 8015498: %s", lr_eval_string("{Result}"));
return 0;
}
*In the above, since the firstname is not at the same level as phone, I tried some path but it did not work.
By what string should I replace ? to get the firstname of the person whose phone number is 8015498 ?
Best,
Sachin