XML 有什么用,我应该什么时候使用它? [英] What is XML good for and when should i be using it?

查看:38
本文介绍了XML 有什么用,我应该什么时候使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇,我一直在开发非常强大的网站/网络应用程序,但我从未学习过 XML,更奇怪的是我从未真正觉得有必要学习.它不像 curl 或 Prepared Statements 在知道它们做了什么以及它们如何工作之前,我有一种感觉必须有一种更简单的方法来做到这一点!"或者必须为此设计一些东西!".

I'm curious, I've been developing pretty powerful websites/web apps, and I've never learned XML, even odder I've never really felt the need to. It's not like curl or Prepared Statements where, before knowing what they did and how they worked, I had a feeling 'there's got to be an easier way to do this!' or 'there's got to be something designed for this!'.

目前我使用 MySQL 和 JSON,我没有这种我需要学习那个"(XML)的感觉,这一定是错误的!

Currently I work with MySQL and JSON and I don't have this feeling of 'I need to learn that' (XML), this must be wrong!

我真的很想听听有关 XML 的一些令人信服的论点,并了解它可以比 JSON 或 MySQL(或 Web 开发的其他方面)做得更好的事情以及我应该何时使用它!

I'm really interested to hear some compelling arguments for XML, and learn about things which it can do beter than JSON or MySQL (or some other aspect of web dev) and when i should be using it!

推荐答案

JSON 非常轻量级,这使得它更适合将数据传递到前端.

JSON is very lightweight which makes it better suited for passing data around to the front end.

XML 具有描述性标签(我个人认为)使原始格式更易于阅读.如果我想从我的程序中加载任何类型的设置文件,我会将它以 XML 文件格式提供.

XML has descriptive tags that (I personally find) make it easier to read in a raw format. If I wanted to have any sort of settings file that is loaded in from my program, i would have it in an XML file format.

无论如何,这就是我的想法,但我相信选择一个而不是另一个有更深入的原因.其中我没有足够的经验来列出:)

That's my idea of it anyway, but i'm sure there are much more in-depth reasons for choosing one over the other. Of which i am not experienced enough to list :)

不过,我确实找到了一些有一些优点的网站.

However i did find a couple of sites that make some good points.

http://ajaxian.com/archives/json-vs-xml-the-debate(评论中有一些优点)

http://webignition.net/articles/xml-vs-yaml-vs-json-a-study-to-find-answers/

这篇关于XML 有什么用,我应该什么时候使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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