5 ms·
> this is a program interchange format, not a format meant to be read by a person So why is it xml? I mean this defeats the whole point. Not to mention how it
by hasenj 9y ago
> this is a program interchange format, not a format meant to be read by a person
So why is it xml? I mean this defeats the whole point. Not to mention how it adds a lot of useless noise.
If it's a program interchange format, it could at least be in binary.
- deno 9y agoThere exists binary XML. What OpenDocument uses is a plain text encoding of XML Infoset[1] (ordered tree of attributes and nodes with optional namespaces and external schema) data structure, but it can be encoded in many ways. You could encode XML infoset as JSON, which for example Google used to sort of do for their old “GData” APIs. (Actually that’s not true, because there’s no such thing as “plain text” so what OpenDocument uses really is a Unicode serialization of said data structure encoded as a (usually) UTF-8 binary stream with an ASCII variable length header directive specifying said encoding.) So why use XML Infoset? Unfortunately for certain qualities you might want in an open document interchange format there’s just nothing better. At any point in an XML Infoset document you can add additional namespaced attributes, nodes and even embed entire documents. For example an ODG document will include SVG elements. Any XML consumer should be able to parse and display a document produced by a completely independent program, and simply skip the parts it doesn’t support. If you were to design a clean slate data structure with similar qualities you would probably get something very similar to XML Infoset. Of course there is a lot of low hanging fruit and XML is by no means perfect. [1] https://en.wikipedia.org/wiki/XML_Information_Set https://en.wikipedia.org/wiki/XML_Information_Set
- hasenj 9y agoI find this hard to buy. Let's start with just one downside (which imo is the killer misfeature): startup time. According to the OP article you have to read the entire xml before you can do anything with it. Surely even if you weren't designing SQLite, it should be possible to design a binary format such that you can read relevant information quickly without loading and parsing the entire binary file.
- deno 9y agoThat’s not an inherent limitation of XML, after all XHTML has no such limitations and browsers support incremental rendering in XML mode (at least Firefox).