From: "NAKAMURA, Hiroshi" Date: 2003-03-19T20:38:28+09:00 Subject: Re: XML too hard (YAML opportunity?) Hi, > From: Richard Kilmer > Sent: Wednesday, March 19, 2003 4:02 PM [snipped great examples; Reading ruby code is much easier than reading English sentence, at least for me] > In XML we have to update our emitter and parser. You are comparing XML and YAML here. But as I wrote in [ruby-talk:54657] [1] and yamlrb author _why kind agreed in [ruby-talk:54697] [2], YAML spec includes more than XML spec defines. Excerpted from [ruby-talk:54657] Though I scanned YAML spec only once, YAML spec includes functions which are equivalent for XML, XML Namespace(sort-of), SAX(stream model), DOM(tree model), XML Schema Datatypes Part2(build-in types), and SOAP Encoding(Collection and Mapping). Users can get big benefit of many functions from YAML without knowing detail of above specs. And your example of YAML; > === Output === > YAML: > yaml = person.to_yaml > puts yaml > --- !ruby/object:Person > firstname: Richard > lastname: Kilmer also includes YAML's Ruby mapping (!ruby/object:... part.) It's to be expected that yamlrb(YAML + Ruby language mapping) can do more without extentions. As Brian stated, we should not compare (plain) XML vs YAML. Comparing XML + some extentions vs YAML for data serialization, I wrote my stance in [ruby-talk:54657] [1]. Regards, // NaHi [1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/54657 [2] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/54697 (From [ruby-talk:54657]) > Let's ask the inverse question: Can XML easily step for YAML? > XML is squeezed > into many case where I believe it doesn't suit as well. > Configuration files, > messaging, data serialization. YAML is engineered for these cases. I agree, except data serialization. :-) I know YAML can serialize heavy-complexed such as map in map in array in ..., including multi-ref object. But editing a YAML-serialized text of heavy-complexed object is as difficult as editing one of XML-serialize, I think. We need special viewer/editor to add a node, cut-and-paste a text, etc. As for this point, XML has an advantage for now. Again, I completely agree with YAML is suitable for not complexed object serialization, such as configuration files, lightweight messaging. And within scripting language world, users doesn't often care its type system. (Without explicit type declaration, YAML serialized text is much smarter.) For me, it's a simple trade-off thing.