5 ms·
XML is not popular because of JavaScript developers. Coming from .NET, I do not care using JSON or XML, because the APIs System.Xml.Linq, Newtonsoft.Json and
by oaiey 8y ago
XML is not popular because of JavaScript developers.
Coming from .NET, I do not care using JSON or XML, because the APIs System.Xml.Linq, Newtonsoft.Json and the upcoming System.Text.Json are a joy to use. I think the lack of good native representation of XML in JavaScript made it a unwanted choice.
Regards SOAP I tend to agree to you. Beyond the Basic profile it was a hassle to interop.
- bastawhiz 8y ago>XML is not popular because of JavaScript developers. This could not be more false. JavaScript is built around the DOM. You can parse XML with DOMParser and query it with the same interfaces that you build your UI with. The X in AJAX is XML. The "good native representation" of XML in JavaScript is the very core data structure that JavaScript was designed to interact with. XML is not popular because it's complex. Escaping is hard. XML bombs make it unusable in its raw form. Fundamentally, XML doesn't give you data structures that look like the ones you use in your application logic. You have to transform your data into something that makes sense in XML, then transform it back. With JSON (and other formats) the data structures that you're given are present in almost every programming language. You don't need to model your data differently for transit or storage than you do in your application logic.
- oaiey 8y agoGood arguments but using DOM Api in JavaScript needs many more lines than JSON parsing and access. jQuery made HTML access bearable for a simple reason: DOM sucks :) Average Joe Dev does not reach the impedance mismatch you mention correctly.
- bastawhiz 8y agoThe DOM interface is roughly the same in almost every language. The JSON interface is almost always simpler. It's no mystery why JSON is more popular. XML never died because of JavaScript developers.
- tannhaeuser 8y agoXML is extremely popular with the JS crowd, they just don't know they're using it ;) JSX (React's template language extension to JavaScript) stands for "JavaScript XML" [1], and there was E4X as an official ECMA spec for XML literals before that (though admittedly not as cool as React is, doesn't have vdom and update events, components for MVC, etc). And JavaScript was indeed invented for DOM manipulation, it's just that the DOM API simply sucks. The whole XML hate thing is symptomatical for the staged this-vs-that discussion we endure in today's forums. I guess there are those document representation schemes that everybody hates on, and those that nobody uses ;) [1]: https://en.wikipedia.org/wiki/React_(JavaScript_library)#JSX https://en.wikipedia.org/wiki/React_(JavaScript_library)#JSX