std.xml2 (collecting features)

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Sun May 10 01:54:08 PDT 2015


On Sunday, 10 May 2015 at 07:01:58 UTC, Marco Leise wrote:
> Am Sat, 09 May 2015 10:28:52 +0000
> schrieb "Joakim" <dlang at joakim.fea.st>:
>
>> On Monday, 4 May 2015 at 18:50:43 UTC, Marco Leise wrote:
>> > Remember that while JSON is simpler, XML is not just a
>> > structured container for bool, Number and String data. It
>> > comes with many official side kicks covering a broad range of
>> > use cases:
>> >
>> > XPath:
>> >  …
>> >
>> > XSL and XSLT
>> >  …
>> >
>> > XSL-FO (XSL formatting objects):
>> >  …
>> >
>> > XML Schema Definition (XSD):
>> >  …
>> 
>> These are all incredibly dumb ideas.  I don't deny that many 
>> people may use these things, but then people use hammers for 
>> all kinds of things they shouldn't use them for too. :)
>
> :) One can't really answer this one. But with many hundreds of
> published data exchange formats built on XML, it can't have been
> too shabby all along.

It's worse than shabby, it's a horrible, horrible choice.  Not 
just for data formats, but for _anything_.  XML should not be 
used.

> And sometimes small things matter, like being able to add 
> comments
> along with the "payload". JSON doesn't have that.
> Or knowing that both sender and receiver will validate the XML 
> the
> same way through XSD. So if it doesn't blow up on your end, it 
> will
> pass validation on the other end, too.

One can do all these things with better formats than either XML 
or JSON.

But why do we often end up dealing with these two?  Familiarity, 
that is the only reason.  XML seems familiar to anybody who's 
written some HTML, and JSON became familiar to web developers 
initially.  Starting from those two large niches, they've 
expanded out to become the two most popular data interchange 
formats, despite XML being a horrible mess and JSON being too 
simple for many uses.

I'd like to see a move back to binary formats, which is why I 
mentioned that to Robert.  D would be an ideal language in which 
to show the superiority of binary to text formats, given its 
emphasis on efficiency.  Many devs have learned the wrong lessons 
from past closed binary formats, when open binary formats 
wouldn't have many of those deficiencies.

There have been some interesting moves back to open binary 
formats/protocols in recent years, like Hessian 
(http://hessian.caucho.com/), Thrift 
(https://thrift.apache.org/), MessagePack (http://msgpack.org/), 
and Cap'n Proto (from the protobufs guy after he left google - 
https://capnproto.org/).  I'd rather see phobos support these, 
which are the future, rather than flash-in-the-pan text formats 
like XML or JSON.


More information about the Digitalmars-d mailing list