gpt4 book ai didi

javascript - 使用 jQuery Mobile 解析 XML 响应字符串

转载 作者:行者123 更新时间:2023-11-28 09:38:10 24 4
gpt4 key购买 nike

在我的应用程序中,我在调用 Webservice 时从服务器获取 XML 响应。响应如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://tempuri.org/">{"rows":[{"noteId" : "1", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "10/27/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Existing","prefdate": "10/27/2011 05:06" }, {"noteId" : "2", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "11/07/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Completed","prefdate": "01/01/2011 05:08" },{"noteId" : "3", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "04/01/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Completed","prefdate": "02/01/2011 05:08" },{"noteId" : "4", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "01/10/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Completed","prefdate": "01/01/2011 05:08" },{"noteId" : "5", "procedure" : "D0140", "teeth": "", "encounterno": "123456" , "WorkflowCode": "Submitted", "datecreated": "01/27/2011", "surf": "", "description": "Limited Oral Evaluation-Problem Focused","status": "Completed","prefdate": "10/05/2011 05:08" }]}</string>

我想使用 jQuery Mobile 解析此字符串,内容将显示在 jQuery Mobile ListView 中。

如何解析此响应?

最佳答案

我想这就是你要找的

http://api.jquery.com/jQuery.parseXML/

获得解析后的对象后,您可以创建一个列表(ul 或 ol)。

然后调用

$(listItem).listview('refresh')

每次添加列表项元素时。

希望这有帮助。

关于javascript - 使用 jQuery Mobile 解析 XML 响应字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12746894/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com