6 ms·
The major issue with XML is all the garbage built on top of it like SOAP, WS-* and horrors like XMLDSIG. Used purely as a markup language it's ok but you reall
by nimish 6y ago
The major issue with XML is all the garbage built on top of it like SOAP, WS-* and horrors like XMLDSIG.
Used purely as a markup language it's ok but you really don't want to be mucking around with stuff like canonicalization at all if you value your time.
- kanox 6y ago> Used purely as a markup language it's ok But people don't use xml as a markup language; they use it for data interchange and for that purpose it's horrible because it maps very poorly to data structures in most programming language.
- paledot 6y agoBingo. This is why I hate XML. Nothing wrong with the syntax - I hate that I have to massage arrays, dicts, etc. in cryptic ways to generate the XML output, then massage them right back at the other end. And PHP's SimpleXML module, at least, is anything but - lots of iterators, casting objects to string, and "where did my data go?".
- guiraldelli 6y ago> [...] and for that purpose it's horrible because it maps very poorly to data structures in most programming language. I disagree with you. A XML file is, by definition, a [context-free grammar](https://en.wikipedia.org/wiki/Context-free_grammar https://en.wikipedia.org/wiki/Context-free_grammar), the same type of grammars used to specify programming languages. I will make it clearer with the examples below: /* a simple data structure */ struct Point { int x; int y; }; <point> <int name="x"></int> <int name="y"></int> </point> /* a recursive data structure */ struct Person { std::string name; std::vector<Person> children; }; <person> <string name="name"></string> <vector type="person"> <person> <string name="name"></string> <vector type="person"> </vector> </person> <person> <string name="name"></string> <vector type="person"> </vector> </person> </vector> </person> To me, it is immediate to see the correct data structure in both examples. If I had to write the second one in JSON, for instance, I would lose the "template type-information" of the list (vector).
- rini17 6y agoBut in practice it ends up any adhoc combination of <point><x>value</x>...</point> or <class name="point"><property name="x" value="value"></property>...</class> You can argue this should not happen, that it's not valid XML, etc...but being so verbose and readable, it tends to attract abuse and then hate.
- guiraldelli 6y agoAnd how is it different from, let us say, the current's sweetheart, JSON? (The comparison is not exclusive to JSON, though.) JavsScript Object Notation makes a lot of sense to describe... The JavaScript objects. But, nowadays, I see it universally applied. As a recent personal experience, I had to use it to serialise communication between a C++ and a Java application---two statically typed languages, with basic types similar among each other but different from JavaScript. To set the contract between the two applications, I had to write a JSON spec [1], which is written in... JSON. That was an abstruse and abusive use of JSON, in my opinion. Then comes `jq` and its own notation, in which I suffer to do the basics of a simple XPath---e.g., return all the objects of a certain kind (i.e., a tag) in any level you find it. Abuse happens [2] because there is a human behind it, especially under the lens of the adage "if all you have is a hammer, everything looks like a nail". The problem I see in this discussion is that people either want a "magic tool" that works at all cases, or they want to control the human behind it. In my experience, it is difficult to get both: generality does not play well with constraint. --- <digression> I think most people just need to use a plain-text format [4] for most of the things they want, à lá RFC 822 [5]. </digression> --- [1]: http://json-schema.org/ http://json-schema.org/ [2]: I believe this is a Fibonacci series: https://www.xorpd.net/pages/xchg_rax/snip_01.html https://www.xorpd.net/pages/xchg_rax/snip_01.html [3]: http://blog.aerojockey.com/post/iocccsim http://blog.aerojockey.com/post/iocccsim [4]: https://www.arp242.net/the-art-of-unix-programming/#id2907428 https://www.arp242.net/the-art-of-unix-programming/#id290742... [5]: https://tools.ietf.org/html/rfc822 https://tools.ietf.org/html/rfc822
- kanox 6y ago> To set the contract between the two applications, I had to write a JSON spec [1], which is written in... JSON. That was an abstruse and abusive use of JSON, in my opinion. The XML equivalent is an XML schema, also written in XML. This is pretty decent as document validation goes. > I think most people just need to use a plain-text format [4] for most of the things they want, à lá RFC 822 [5]. You linked to formats which don't even support nesting. If you roll your own markup it's going to be brittle and people are going to parse it with regexps.
- basscomm 6y ago> But people don't use xml as a markup language; I do. I use it to build a simple website (well, 'simple' being relative, I guess), and for that it works fairly well.
- agumonkey 6y agoxml alone has a few flaws (empty text nodes) but nothing major the xml everything culture was a faux-progress (basically language design gone wild)
- bawolff 6y agoI recently had to learn about SAML so i read about XML signatures. That's probably one of the worst concieved security standards i have ever read. It should be in a museum for how not to make security standards. Honestly though, i don't think its entirely possible to separate XML from the culture around it. XML encourages a certain way of doing things that leads to bad, problematically complex, outcomes.
- jaywalk 6y agoIt's truly a shame that SAML has become the "enterprise" standard when OIDC is superior in every way.