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

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

问题描述

我很好奇,我一直在开发非常强大的网站/网络应用程序,我从来没有学过XML,甚至从来没有真正感觉到需要。它不像卷曲或准备的声明,在知道他们做了什么和他们的工作之前,我有一种感觉,必须有一个更简单的方法来做到这一点!或者必须是为此设计的东西! / p>

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



我真的有兴趣听到一些引人注目的XML参考,并了解可以比JSON或MySQL(或Web开发人员的其他方面)做得更好的事情,当我应该使用它!

解决方案

JSON是非常轻量级的,这使它更适合传递数据到前端。 >

XML具有描述性标签(我个人发现)使得以原始格式更容易阅读。
如果我想要从我的程序中加载任何类型的设置文件,我将以XML文件格式。



这是我的想法无论如何,但我相信有更多的深层原因选择一个在另一个。其中我没有足够的经验可以列出:)



然而,我确实找到了几个网站,使一些好点。



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



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


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!'.

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!

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 is very lightweight which makes it better suited for passing data around to the front end.

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 (Some good points in the comments)

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

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

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