3 ms·
Oh, I don't think there's anything wrong with using XML for data - it's just that these "XML sucks" rants always seem to assume that's all it's used for. I kno
by bct 19y ago
Oh, I don't think there's anything wrong with using XML for data - it's just that these "XML sucks" rants always seem to assume that's all it's used for.
I know that a JSON version of my XHTML fragment up there would suck pretty hard; would a s-exp one be any better? (honest question)
- fauigerzigerk 19y agoWhy would the JSON version of that fragment suck pretty hard? I don't think there is any rational argument for XML, JSON or s-expressions solely based on whether something is data or a document. I think to make that judgement, we need to consider things like when do we really need namespaces? How often is a particular expression written by hand, how often is it generated automatically? How important are different character encodings? Does it have to be bandwidth efficient? Is this a type of data that might actually morph into a program or is that something we want to exclude for security or complexity reasons? Are there existing tools that help us to process one or the other representation more easily? All these things depend on many more aspects than just data or document.
- olavk 19y ago> Why would the JSON version of that fragment suck pretty hard? The fragment uses attributes and mixed content - something that would be quite ugly to express in JSON. I wont event try.
- bct 19y ago> Why would the JSON version of that fragment suck pretty hard? ["p", "this is a", ["a", { "text" : "link", "href": "http://example.com" } ], "." ] I don't do much JSON so maybe that can be improved, but I wouldn't imagine by much. Certainly there are lots of other factors to be considered, but that just goes to prove my point; that "XML Sucks" rarely looks at anything beyond very simple uses of XML.
- fauigerzigerk 19y agoMaybe like this: ["p", "this is a", ["a", "link", {href: "http://example.com http://example.com"}], "."] If that is uglier is debatable, maybe a little bit. However, the point is really that suckyness is not just a matter of esthetics. All the more I agree with your second point.
- twism 19y agoi think both JSONs above are a bit lispy :)... {"p":{">":"this is a","a":{"@":"http://example.com",">":"link"},">":"."}
- twism 19y agomissing closing "}"
- bct 19y agoNow bold something inside the link, and put a class attribute on the paragraph.
- twism 19y agoi actually thought about that, its harder to read than plain ol html {"p":{">":"this is a","a":{"@href":"http://example.com","b":{">":"link"}},">":".","@class":"my-p-class"}}
- leoc 19y agoNow imagine the complete works of Shakespeare in that format...
- fauigerzigerk 19y agoyou're right, but look at an average html page. Is that pretty? I guess it makes no sense to argue about purely syntactical issues. Comparing static HTML and JSON is not what it's about in the real world.