6 ms·
I said nothing about HTML though, did I. JSON and XML are both difficult to edit by hand, so don't do that. JSON, arguably, is harder to edit by hand because
by cryptonector 8y ago
I said nothing about HTML though, did I.
JSON and XML are both difficult to edit by hand, so don't do that. JSON, arguably, is harder to edit by hand because there's no CDATA, so you have to know how to escape characters, especially newline.
Both are tree-like structures. Why would one be better than the other? Well, XML has a long history of use and development for text documents, whereas JSON does not, so right there, that argues against JSON.
Does XML suck for WYSIWYG editing? I don't see why it would suck more than, say, TeX. LyX -a WYSIWYM editor for LaTeX- exists, and it can output XHTML using a LyX-specific schema. I'm sure LyX could easily have been built using an XML format from the get-go. You've not made any arguments as to why XML suck for WYSIWYG editing -- the example you pasted surely is meaningless in a WYSIWYG editing since that kinda implies having... a WYSIWYG (GUI) editor. And surely JSON will take more ceremony to express 'bold and italic' than XML, and not much less ceremony than XML to express 'use this specific font' (where the font's name alone is lengthy enough).
All you've done is expressed a preference for encoding details that no one really cares about, and you may not have stopped to really learn and understand XML, so your preference is leading you into making a number of mistakes the most important of which is NIH reinvention. Each NIH reinvention adds a fair amount of cognitive load for the rest of us, and adds development and maintenance burdens that never go away. Please don't do this. Innovation is very important, of course, but don't blindly reinvent to innovate.
- lewisjoe 8y agoI agree. I may have misinterpreted the original comment. Yes, in that way XML is indeed a better way to put it. I'd still stand by my opinion on not-making formatting information as separate tags and blowing the tree one level deeper. Preserving formatting options as index based properties would make editing APIs simpler and convenient. Again, this is nothing in regard to the original comment. Just putting it out there.
- chii 8y agoXML per se is great for storing tree like structures. However, it's not actually XML that's bad, but content editable, which is what most editors were using until recently. In content editable, the visual information is not one to one transferable to a single html document, which, in turn, means not transferable to a single XML representation (and in all likelihood, the html is what is used as the representation, not a transformed XML document). With Json representation , the content editable method is no longer the path of least resistance. Building out a proper renderer (whether in canvas or dom) means you end up removing most of the content editable issues.
- cryptonector 8y agoJSON is harder to edit manually, honestly. Don't do it. Use an editor that supports editing the format.
- ZenPsycho 8y agoNobody is talking about editing the JSON directly. They are talking about programming a wysiwyg editor to the JSON data model.
- cryptonector 8y agoI would say XML vs JSON makes little difference to the complexity of an application (e.g., an editor) using it.
- deleted 8y ago[deleted]
- ZenPsycho 8y agomanipulating JSON (really, just plain native language objects) is way more straightforward than manipulating the XML dom. The purpose of formats like this is to make inexpressible the kinds of documents that result in difficult to untangle bugs, and frustrating UI behaviour. See this article about how Medium's editor was designed for some essential background of the motivation for this JSON format https://medium.engineering/why-contenteditable-is-terrible-122d8a40e480 https://medium.engineering/why-contenteditable-is-terrible-1...
- deleted 8y ago[deleted]
- fourneau 8y agoUntil recently? What are most editors using now?
- zmix 8y ago"contenteditable" is an HTML5 (!) attribute defined by the XML hating HTML5 group. Right?