ログインしてさらにmixiを楽しもう

コメントを投稿して情報交換!
更新通知を受け取って、最新情報をゲット!

XMLコミュのDoes XML suck? Or XML vs YAML... XML vs JSON

  • mixiチェック
  • このエントリーをはてなブックマークに追加
I like XML ;)

I've spent a lot of time working with XML-formatted data and with XSLT and other XML processing tools. I feel comfortable working with it. It doesn't "rub me the wrong way".

However, other programmers I know absolutely hate XML and would rather use anything but XML, given a choice. And more and more, I see a movement happenings to get away from XML for many things -- the people guiding development of some other technologies/languages/systems are choosing to avoid XML when then can.

A common example is Ajax. Most Ajax developers these now seem to be choosing to build apps that use JSON instead of XML for the (improperly named I guess) XMLHTTPRequest objects. Personally, I think they are probably right to do that. I think for most Ajax apps, the value/benefits of using JSON are higher than those of using XML.

Another example is the world of Rails and Ruby, where YAML is the standard format for config files and some other things. They made a conscious decision to is use it instead of XML. Part of the reason, I think, is that many people working with Rails now have some exprerience working in the hellish world of Java and Struts, where they just went way overboard with use of XML config files for everything.

Anyway, I've been using Rails recently and have taken a liking to YAML, and think that if using YAML helps to make it possible for more people to use Rails instead of Java-based MVCs -- if it helps more people get more apps built more quickly -- then it's a good thing, and it's probably better than having Rails use XML for those things.

So, can anybody think of other apps/systems/frameworks where XML is used now, where there might be alternatives that could be better?

Conversely, can anbody think of places where XML is used now where it probably *is* the best format?

For example, XSLT. For me, having a transformation stylesheet in the same format as the data you are using it to transform is very powerful. It is hard for me now to imagine taking the things I do now with XSLT and trying to do them with... something else.

Other examples?

返信は日本語でどうぞ。もちろん英語でも大丈夫。

P.S. Sorry for being lazy and posting in English but it takes me twice as long to write in Japanese as in English. But I can read Japanese much more quickly than I can write it. So reply any way you want. Reply in French or Parseltongue if you want. Hey, wait, aren't French and Parseltongue the same thing? :)

コメント(4)

はじめまして。
私はWeb系のプログラマーをしています。
XMLは勉強し始めたばかりですが、バッドマザファカーさんが言うように、XMLとXSLTの組み合わせに注目しています。
というのは、Web系のプログラミングでは、デザインとシステムの分業が重要になるからです。
HTMLの記述にプログラムを埋め込んでいく方法だと、デザインの変更があるたびに埋め込み直すことになり、余分な手間になるうえ、不具合の原因になりかねません。
XMLとXSLTで、データとデザイン部分を完全に切り離すことができれば、そのような手間は省けます。

・・・と、初心者ながらに考えていることで、こちらのコミュニティのみなさんにとっては、当たり前だったり、もしかして見当はずれだったりするのかもしれません(^_^;
I think XSLT is the most powerful way to deal with XML, especially with multiple namespaces and/or documents to input. Unlike DOM, using XPath with XSLT allows you to flexibly and unambiguously access/create nodes that you exactly want, "awaring" of namespaces. The notion of XML Namespace may have hurt many programmers, but it is still needed to satisfy one of the requirements for the world wide standard format--distinguishing and personalizing vocabularies anyhow. I guess at once you get to need to share or publish data in a certain format at the level of the entire world (i.e. RSS, XHTML, etc), a data format without any substitutes for XML Namespace won't work as good as XML family does. In other words, XML can stay as the top level format whereas other formats, such as YAML and JSON, work well below that level, having their own applications.
未来,

I can see what you're saying and I agree the XML and XSLT combination it one way to get a clean separation between data/content and presentation in delivering info to the Web.

But...

For more complicated Web-based apps, particularly apps that require a lot of database interaction, I think the kind of separation that XML/XSLT (or XML/CSS) provides is "orthogonal" or not directly related.

What I mean, for example, is that one approach that a lot of designers take to building those kinds of apps is the MVC (model-view-controller) approach. As in Struts and now in Ruby on Rails. And at least in the case of Rails, XML is not an essential ingredient and in the case of many Rails apps, not even an ingredient at all.

Yet those MVC-based apps to provide a clean separation -- and not just a separation between the data and presentation; their design is meant to separate out the "business logic" into a different layer too. All without necessarily needing XML or XSLT at all.
哀,

I agree very strongly with what you said about XPath and XSLT vs. DOM manipulation. For cases where you're programatiically generating XML data that you then need to generate some other output from (HTML or whatever), I think XSLT is a lot cleaner than, say, embedding the transform logic into the rest of your code. With XSLT, you can even switch an app to a whole new language (say, from Perl to Ruby), and if your transform logic is an external XSLT stylesheet, you don't need to change a thing -- just call the same stylesheet.

I agree namespaces are powerful and namespace-aware XML parsers and tools are powerful.

I agree that JSON is not a general solution -- it's basically a single-purpose format that has a use only with just one programming language (Javascript).

But I think YAML has broader applications as a data-serialization format. Not as broad as XML, but certainly broader than just being used for config files. And it is documented standard of sorts. Though not one recognized by any standards bodies.

ログインすると、みんなのコメントがもっと見れるよ

mixiユーザー
ログインしてコメントしよう!

XML 更新情報

XMLのメンバーはこんなコミュニティにも参加しています

星印の数は、共通して参加しているメンバーが多いほど増えます。

人気コミュニティランキング