使用XML或SQL存储数据? [英] Storing data in XML or SQL?

查看:63
本文介绍了使用XML或SQL存储数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Windows Phone 7.5应用程序。

I'm developing a Windows Phone 7.5 app.

我必须存储22个具有以下字段的项目:

I have to store 22 items with the following fields:


  1. 编号(int)。

  2. 名称(字符串)。

  3. 说明(字符串)。

名称和描述将使用多种语言。

Name and description will be in various languages.

现在,我是使用这样的XML文件:

Now, I'm using a XML file like this:

<?xml version="1.0" encoding="utf-8" ?>
<cards>
  <card id ="0" name="Mad" description="xxx" ></card>
...
</cards>

我没有使用XML太多,我不确定哪种方法是最好的

I haven't work with XML a lot, and I'm not sure which is the best way to do it.

有什么建议吗?你推荐我什么?我需要将每个名称和描述存储在不同的语言中。

Any advice? What do you recommend me? I need to store each name and description in different lanaguages.

推荐答案

我将按照以下方式构造xml

I would structure your xml as follows

 <cards>
   <card id ="0">
      <name lang="en">Mad</name>
      <description lang="en">xxx</description>
   </card>
   <card id ="1">
      <name lang="fr">Brother</name>
      <description lang="fr">xxx</description>
   </card>
   .... etc ....
 </cards>

在此结构中,每个元素只有1个属性,很容易找到子元素

By having it in this structure you only have 1 attribute per element and it is easy to find child elements which is the data you are looking for.

实际上,这个
还有一个问题 XML最佳做法:属性与其他元素

这篇关于使用XML或SQL存储数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆