如何将 sencha 中的 REST Web 服务调用返回 xml 转换为 json

发布于 2025-01-02 23:04:22 字数 85 浏览 2 评论 0原文

Web 服务请求返回 XML。如何在 sencha touch 中将其转换为 JSON,然后将数据加载到列表中?我怎样才能选择哪些信息可以存储在本地存储中?

Webservice request returns XML. How do I convert this into JSON in sencha touch and then load the data into a list? How can I also choose which information could be stored in the local storage?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葵雨 2025-01-09 23:04:22

首先,您需要为此创建模型并存储。

您可以像这样创建模型,

 Ext.regModel('Travel', {
  idProperty: 'Travelled',
   fields: [ { name: 'Month', type: 'string' },
         { name: 'Travel', type: 'int' },
         { name: 'Addition', type: 'int' },
         { name: 'Traveled', type: 'int' },
         { name: 'outcome', type: 'int' }]
   });

并像这样存储

 Ext.regStore('TravelStore', {
model: 'Travel',
storeId: "TravelID"
});

,并且需要在 Xml 响应的帮助下使用数组将数据传递到此存储中。

first you need to create model and store for that.

you can create model like this,

 Ext.regModel('Travel', {
  idProperty: 'Travelled',
   fields: [ { name: 'Month', type: 'string' },
         { name: 'Travel', type: 'int' },
         { name: 'Addition', type: 'int' },
         { name: 'Traveled', type: 'int' },
         { name: 'outcome', type: 'int' }]
   });

and stor like this

 Ext.regStore('TravelStore', {
model: 'Travel',
storeId: "TravelID"
});

and you need to pass the data into this store by using arrays with the help of Xml response.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文