3 ms·
XML wouldn't have filled the void well for JavaScript though. Their goal was to send data back and forth and would ultimately need to be processed and rendered
by BinaryIdiot 10y ago
XML wouldn't have filled the void well for JavaScript though. Their goal was to send data back and forth and would ultimately need to be processed and rendered by JavaScript. Easiest way to do that is to just send a JavaScript object back and forth.
It would have been a lot cheaper to parse JSON into JavaScript objects especially back then on the more limited hardware than trying to parse XML.
- ttepasse 10y agoPretty soon with the birth of JSON everyone stopped using eval() because of obvious security concerns (eval is evil) and JSON parsers before JSON.parse() were doing the heavy lifting handwritten in JS. That was also the time when XML/XHTML on the web wasn't as disregarded as today. Browsers are XML parsing software. They exposed JS Interfaces for these XML parsers. And a query interface. And the DOM. Etc. My thesis: The data to send mostly matches a tree of structs and arrays and values which we use in programming languages. XML is not the perfect vessel for that, it's better used as a document format. XML of course was misused as a configuration format in the decade before, leading to the backlash.
- flukus 10y ago> XML wouldn't have filled the void well for JavaScript though This isn't hypothetical. It did fill that void before we had JSON, it's what the X in AJAX stood for. Browsers were parsing xml before javascript existed. In hindsight, JSON was the first sign of the wheel reinvention that was to come from the javascript world.
- BinaryIdiot 10y agoI think you missed the "well" in my quote (no one said it was hypothetical). Naturally the XMLHttpRequest / AJAX was used with XML first. Microsoft were the ones to introduce it to do exactly that; work with their exchange server's XML. This is why I said "well". XML isn't a perfect fit into JavaScript's existing objects. It's awkward. Mozilla, imperfectly, copied the interface Microsoft came up with to have a sort of standard and 4 months after that Crockford started using JSON[1]. I don't see much history of applications beyond Microsoft's and a few edge cases that really used XML here; most of what I can find online had a lot of people's first usage of AJAX with JSON or plain text. But I'll admit it's very difficult to find solid data. But ultimately XMLHttpRequest came out, in its very first ActiveX form in IE, in March 1999 and Crockford started playing with JSON in April 2001. Wikipedia claims XMLHttpRequest didn't become a de facto standard until 2004 when other browsers started adopting it[2] so I'm not convinced it was used for very much XML to begin with. [1] https://www.youtube.com/watch?v=-C-JoyNuQJs https://www.youtube.com/watch?v=-C-JoyNuQJs [2] https://en.wikipedia.org/wiki/XMLHttpRequest https://en.wikipedia.org/wiki/XMLHttpRequest
- taeric 10y agoActually, the easiest way is to just send HTML down to the browser. This was the rallying cry of XHTML for a while. You have client side code that calls for an update to a section of the page, and the framework sends down the necessary html to replace it.