|
本帖最后由 3396408 于 2012-3-28 16:29 编辑
- int find_cnt;
- char *xml_input =
- "<acme_org>"
- "<employee level=\"manager\">John Smith"
- "<cubicle>227</cubicle>"
- "</employee>"
- "</acme_org>";
- find_cnt = lr_xml_find("XML={XML_Input_Param}",
- "ValueParam=cubicle",
- "Query=/acme_org/employee",
- LAST );
复制代码 这样无法查询出“cubicle”这个属性,看了帮助文档,貌似应该是可以查询出这个属性值是否存在的,上述代码具体要怎么修改才可以呢?
- char * xml_input =
- "<acme_org>"
- " <accounts_dept>"
- "<employee>"
- " <name>John Smith</name>"
- "<cubicle>227</cubicle>"
- "<extension>2145</extension>"
- "</employee>"
- "</accounts_dept>"
- "<engineering_dept>"
- "<employee>"
- "<name>Sue Jones</name>"
- "<extension>2375</extension>"
- "</employee>"
- "</engineering_dept>"
- "</acme_org>";
- int find_cnt;
- lr_message(xml_input);
- lr_save_string(xml_input,"xml");
- lr_message(lr_eval_string("{xml}"));
- lr_save_string("2145","Xx_1");
- lr_save_string("2375","Xx_2");
- find_cnt = lr_xml_find("XML={xml}",
- "ValueParam=Xx", /*查找多个参数是否存在是用到的,注意参数没有{}*/
- "SelectAll=yes",
- "Query=//extension",
- LAST );
- lr_message("lr_xml_find成功次数:%d",find_cnt);
复制代码 |
|