

XML Sucks (a.k.a. Why S-expressions Are Better) - dpapathanasiou
http://www.hcsw.org/XML.html

======
fauigerzigerk
I like s-expressions. But this guy makes a slightly odd argument that doesn't
help his cause at all. He basically says XML is too complex, but s-expressions
are really simple if you are an experienced lisp hacker. Otherwise, so he
says, "this is going to get really hard really quickly".

~~~
Goladus
Actually he basically says XML is a complex, unpredictable mess _that is not
actually extensible_ ; while s-expressions are simple, stable, _and
extensible_. (Though extending them is still a somewhat advanced topic.)

~~~
olavk
He is kind of right, since he is talking a about extending the basic XML
_syntax_, not about creating or extending XML vocabularies. Obviously his
solution with reader macros only works in Lisp, and he seem to be proud about
that, but it kind of defeats the purpose of a platform-independent exchange
format.

------
mojuba
I raised this problem earlier on HN and never got the answer to this question:

Let's say I hate XML and I love S-expressions. I'm willing to replace all my
XML with Sexp _now_ and all I need is a clearly defined syntax with charsets,
escapes and all, so that I can write generators and parsers. That spec would
probably fit 2 or 3 pages, but someone has to do it carefully. So where is it,
the Sexp syntax for representing tree structures everybody's talking about?

~~~
tokipin
i'm not sure what you're asking. s-exp's already represent trees:

(html (head (title "hi" ) ) (body (h1 "hello" ) ) )

then (defmacro html ... ) to transform it. so lisp already has the syntax, the
parsers, and the generators

~~~
mojuba
I understand that's simple in Lisp, but I also need interoperability, and that
implies different languages, among other things. Perhaps the reason nobody's
adopting Sexp's is that you will never get an answer from lispers, other than
"you can do it in Lisp". Great, but I need C++, Perl, then C#, Java, PHP,
Python and all kinds of crappy languages to support that format.

~~~
tokipin
lisp syntax is a lot simpler than XML. a basic lisp _interpreter_ would take
maybe a night or three in any language, a mere parser much less. but why you
don't see many such parsers is a different issue, not closely related to
s-exp's themselves

~~~
inklesspen
So, why _don't_ you see many such parsers?

------
olavk
XML is supposed to be a human-readable platform- and language-independent
format for data and document exchange. The article just shows that you can do
all kinds of cool stuff with s-expressions if you happen to use CL.

Just as if a smalltalk enthusiast proposed exchange of serialized smalltalk-
images as the universal solution for data interchange. Because XML is just to
complex to parse.

~~~
Tichy
Didn't read the article through to the end, but I suppose, if you can use an
XML parser to read a document, you might as well use a S-Expression parser.

------
axod
I like JSON. Easy to read, easy to work with.

~~~
cmars232
I prefer JSON too.. it provides a more natural expression of associations,
objects, etc. Sure, you can represent any XML/JSON in sexps, but then you have
to come up with a convention, follow it, explain it, and check that its
followed correctly.

JSON is a precise DSL for declaring basic data structures -- semantic
batteries included! Why re-invent the wheel?

------
bct
XML is for documents, s-expressions (or JSON or YAML or ...) is for data.

~~~
mdemare
I knew there was a code/data divide, but not that there also was one between
documents and data.

~~~
cstejerean
A document needs to contain information (most of the time) about the layout of
the document. So an HTML page is a document most of the time. The data is the
TEXT and most of the HTML is there simply to tell the browser how to render
the data. I think the argument above was that XML is great for creating
document formats where as JSON or S-Expressions are great for sending data
around.

