What's with all the XML hate? Of course, doing everything in XML is a stupid idea (e.g. XSLT and Ant) and thanks heaven that hype is over. But if I want something that is able to express data structures customized by myself, usually with hierarchical data that can be verified for validity and syntax (XML Schemas or old-school DTD), what other options are there? Doing hierarchical data in SQL is a bitch and if you wan…
Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
61–70 of 265 posts
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#62Earlier quoted context omitted.
How so? XML by itself only supports strings; any other data types have to be derived from a schema. But you can do the same with any other format that supports strings, including JSON.
But in the design of XML this was already acknowledged. That's why there is the distinction between well-formed and valid XML documents. Only with valid XML documents there is a schema attached that will describe these nodes with the type attribute. And because it is extendable, these types can be anything but they will be automatically validated by the parser. JSON OTOH doesn't have this extensibility. There are a c…
What's the issue?
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#63Earlier quoted context omitted.
One of the core aspects of XML that is really important is that no typing is inferred by the structure of the file unlike JSON. JSON is by nature tied to the JavaScript type system which is sparse and inaccurate. For example, if you look at the following: { "name": "bob", "salary": 1e999 } Ah crap! Deserializer blew (in most cases silently converting the number to null) bob 1e999 No problem. The consumer can throw th…
And the following is not acceptable as it breaks the semantics of JSON and requires a secondary deserialisation step as strings ain't numbers... XML strings ain't numbers neither. You can throw a big decimal deserialiser (e.g. as a custom deserialization adapter) at a JSON document as well.
XML doesn't have strings (or types at all really)
JSON strings are strings.
There is a massive semantic difference here when it comes to parsing.
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#64Earlier quoted context omitted.
XML is unnecessarily verbose, for the supposed sake of human readability. But used as a serialization format, it isn't really readable or editable by humans (except in the sense that a Turing machine is programmable): remember that the ML in XML stands for "markup language", and SGML, its predecessor, was designed as a way of marking up normal text, not littering data with angular brackets and identifiers. (XML/SGML…
You fail to address OP's question: > But if I want something that is able to express data structures customized by myself, usually with hierarchical data that can be verified for validity and syntax (XML Schemas or old-school DTD), what other options are there?
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#65Earlier quoted context omitted.
XML is unnecessarily verbose, for the supposed sake of human readability. But used as a serialization format, it isn't really readable or editable by humans (except in the sense that a Turing machine is programmable): remember that the ML in XML stands for "markup language", and SGML, its predecessor, was designed as a way of marking up normal text, not littering data with angular brackets and identifiers. (XML/SGML…
You fail to address OP's question: > But if I want something that is able to express data structures customized by myself, usually with hierarchical data that can be verified for validity and syntax (XML Schemas or old-school DTD), what other options are there?
Which IMO is a sensible way looking at it. I too think XML is not perfect but if all the other stuff we're stuck with currently would be as good enough as XML, IT would be a place with less WTFs all around. ;-)
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#66Earlier quoted context omitted.
How is YAML a superset of JSON? Do you mean 'conceptually'?
To be specific, JSON syntax is a subset of YAML version 1.2. However, I hate YAML with a passion. It is worse than XML in my books. I can usually read JSON fine. I can also read XML in many cases. For the life of me, I just can't read YAML. It has something to do with "-", line indentation and different ways of writing lists. Of course, someone will say YAML is technically better ...
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#67What's with all the XML hate? Of course, doing everything in XML is a stupid idea (e.g. XSLT and Ant) and thanks heaven that hype is over. But if I want something that is able to express data structures customized by myself, usually with hierarchical data that can be verified for validity and syntax (XML Schemas or old-school DTD), what other options are there? Doing hierarchical data in SQL is a bitch and if you wan…
If we start out instead with something that's turing complete and simple to begin with (perhaps S-expressions?), we can (often trivially) write our own validators/type-checkers, or any other processing tool to verify the document structure, with few or no constraints, and without requiring the effort and expertise to parse complex syntax.
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#68Earlier quoted context omitted.
The issue is probably that 99.999% of all XML use cases don't use (or need) the verification aspect. For all of those, XML is overkill. Besides, surely it would be possible to design a verification layer on top of JSON, for instance - the fact that one does not currently exist does not mean that XML (and abuse of XML!) should not be criticized.
One of the core aspects of XML that is really important is that no typing is inferred by the structure of the file unlike JSON. JSON is by nature tied to the JavaScript type system which is sparse and inaccurate. For example, if you look at the following: { "name": "bob", "salary": 1e999 } Ah crap! Deserializer blew (in most cases silently converting the number to null) bob 1e999 No problem. The consumer can throw th…
{"name": "bob", "salary": "1e999"}Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#69I think this title is wrong. Firstly some clarification - this appears to just be about the persistence format for his dive log. It was XML, now it's git based with plain text. As someone who had to manage a system which worked with plain text files structured in a filesystem for a number of years in the 1990s, this is done to death already. You now end up with the following problems: locking, synchronising filesyste…
Which is why he's reusing git for resolving those pain points? Well presumably all except "synchronizing filesystem state with the program" -- where he's gone from using some kind of xml parser to marshal xml to objects/structs in ram to using a (simple(r)?) text parser to do the same.
I'm guessing he just writes/reads a full (part) of a log (a branch of the full tree, or whatever is used in the program. Maybe a list anchored at a date?) -- and lets git sort the history/backup thing.
So, yes, it's a different format, but I think the argument you're making is off -- seeing as he already has git for that? It's more like combining Maildir (or mboxes, only commited when valid) and git.
Re: Linus Torvalds: “I'm happily hacking on a new save format using ‘libgit2’”
#70Earlier quoted context omitted.
But in the design of XML this was already acknowledged. That's why there is the distinction between well-formed and valid XML documents. Only with valid XML documents there is a schema attached that will describe these nodes with the type attribute. And because it is extendable, these types can be anything but they will be automatically validated by the parser. JSON OTOH doesn't have this extensibility. There are a c…
Only with valid XML documents there is a schema attached that will describe these nodes with the type attribute. http://json-schema.org/ What's the issue?
It only has "complete structural validation". Which means it doesn't feature custom types.
Although it adds a workaround for the date issue by adding a handful of supported sub-types (http://json-schema.org/latest/json-schema-validation.html#an...)
It is far from what validation XML Schemas offer.