4 ms·
I'm using XML for SOAP Web services. They are much easier to use than REST, thanks to code generation. I did not try GRPC though. XML is awesome for configurat
by vbezhenar 5y ago
I'm using XML for SOAP Web services. They are much easier to use than REST, thanks to code generation. I did not try GRPC though.
XML is awesome for configurations: with proper XML Schema and proper editor (I use Jetbrains Idea, but there are other options) you'll get almost full validation, auto-complete for free.
I would prefer XML for any markup.
JSON have one important advantage over XML without DTD/Schema: it's impossible to express array in XML. Another less important advantage is that there's only one way to stringify graph of arrays/maps into JSON. With XML there's no "official" standard, there are plenty of different ways to write maps, for example. But DTD/Schema solves those shortcomings.
- cunthorpe 5y agoAny ML can have schemas and JSON does, I don’t know what you’re talking about. What you describe is all just about support from tools, which JSON has plenty now. The advantage that a ML can have over another is how easy it is to: - parse by the machine - read and edit by humans Also useful but less so: - esoteric features like cyclic dependencies - size
- Ygg2 5y agoYeah, but Yaml and to some extent JSON tooling just shrivel compared to XML. I had to edit Liquibase configs in YAML and XML. YAML was a fucking nightmare.
- pydry 5y agoXML tooling is fucking horrible. I still get flashbacks to maintaining XSLT sometimes. It was a tool that didnt really need to exist and arguably did more harm than good by being "recommended". I remember very clearly that although XML had tooling for schema validation it was awful and people tended not to get beyond the "DTD vs XSD" debate before giving up on it. Both of them sucked. Then there's XPath. Why XPath? Because if your markup language doesnt map to normal programming data structures you need a band aid to fix it. As for SOAP.... that can die in the fiery pits of hell with XMLSpy.
- Ygg2 5y agoI said tooling was superior, not XML tooling was a silver bullet. DTD is mostly just an attack vector. XSD or Relax NG are both solid. XQuery was kinda useful but XML people went too far and started adding shit that it doesn't belong to it. XSLT like has one or two credible use cases, like replacing entity expansion from DTD. Rest of it was just like XML database doomed from the start. SOAP. I never saw it actually being used.
- pydry 5y agoSuperior to what, though? Most of this tooling has equivalents that are barely used because they didnt really need to exist in the first place (e.g. XSLT) or were a band aid over problems with XML itself (XPath / XMLSpy). That leaves JSON schema, which - still more pleasant than XSD or DTD.
- TedDoesntTalk 5y agoI worked on a website that generated all HTML through XML data with XSLT templates. It was possibly the worst experience of my career.
- kaba0 5y ago> Why XPath? Because if your markup language doesnt map to normal programming data structures you need a band aid to fix it. How do you express easily “every element that has X in its path” with a programming language? Of course you can write such a program but it is similar to regex - you could write a FSM but it is much easier to use a DSL for that.
- tored 5y agoJSON schemas are horrible though. Every implementation I tried didn't fully respect the entirety of the JSON schema specification. JSON schemas are by default non-strict, which is the opposite what you want.
- tored 5y agoYou can use something like OpenAPI to get code generation for REST, but yes you have to write an OpenAPI spec for your API in YAML... Not a fan of XML, but I think XML Schema is one of the better Schema solutions I have used. If you doing something with XML and not take advantage of XML Schema it seems like a waste. XML for markup is okay, but usually I just use a subset of HTML5 when doing that, XML would have the benefit of having XML Schema support for validation, but I have class that can do that for me with HTML5.
- forty 5y agoI don't think there is only one way to stringify a given object in json. Some things that comes to mind: - numbers are a mess. You can have the full decimal numbers, the "e" notation, and sometimes you have to use strings for number that are too big for JavaScript. - Map keys order is not significant, so it can be any order.