Live data from Hacker News

Do you hate XML? (2010)

sigfrid-lundberg.se

61–70 of 99 posts

Re: Do you hate XML? (2010)

#61
post #34

My reasons to hate XML: - element vs attribute ambiguity - model of the document does not fit nicely to programming model of structs, dicts and arrays - too many complexities (entities, cdata, parser directives) - cardinality unknown without schema (is that a single value, or an array that just happens to have one element) - order of elements may or may not be significant depending on schema - not really extensible i…

JSON does data exchange ok. Protobuf does it very well. Google fumbled its ecosystem, should've focused on establishing it as an easy alternative to HTTP+JSON, instead focused on gRPC which is its own thing. Textproto is quite readable and supports comments, great for config files.

XML is so much fuss for nothing. All that xmlns uri whatever stuff and it still doesn't tell the other side how to parse it.

Re: Do you hate XML? (2010)

#62
post #59
post #17

Earlier quoted context omitted.

> The worst part about it is the tags vs attributes fights. They both do the same thing and the only difference is preference. They're not the same thing. If you look at it as the extensible markup language for documents that it is, "tags" (i.e. inner content) would be visible and "attributes" would not. If your XML document was processed by an application to convert to another type of document (PDF, etc.), and it di…

> If you look at it as the extensible markup language for documents that it is, "tags" (i.e. inner content) would be visible and "attributes" would not.

[deleted]

Re: Do you hate XML? (2010)

#63
post #59
post #17

Earlier quoted context omitted.

> The worst part about it is the tags vs attributes fights. They both do the same thing and the only difference is preference. They're not the same thing. If you look at it as the extensible markup language for documents that it is, "tags" (i.e. inner content) would be visible and "attributes" would not. If your XML document was processed by an application to convert to another type of document (PDF, etc.), and it di…

> If you look at it as the extensible markup language for documents that it is, "tags" (i.e. inner content) would be visible and "attributes" would not.

[deleted]

Re: Do you hate XML? (2010)

#64

XML was a good, well-intentioned idea. The problem, IMHO, was that rampant "xml-abuse" in the naughts. ws-* standards and over-engineered garbage like SOAP ("complex object access protocol") made people loathe XML. I did like JAXB in Java, XLST, schemas, XPATH. Never got into XSL, but it seemed like good thing too. It worked best when your tooling manipulated it for you or at least helped you in an intelligent way. M…

SOAP seems totally in line with the XML philosophy.

Re: Do you hate XML? (2010)

#65
post #2

In my opinion, the reason people hate XML is because of what M signifies: it is a markup language and most of the time we don’t need a markup language. Markup languages are great for rich text documents. They are just not a good fit for representing data. The markup-nature of XML introduces unnecessary choice in whether to use an attribute or a child element to represent data; for HTML such ambiguity doesn’t actually…

Attributes are intended to hold metadata, not data. It's not the fault of the format if someone chose to use it in a poor way. You also need to distinguish the format itself from the various libraries that may be available to parse/process it in a given language. It doesn't always make sense, even when it's an option, to let the tail wag the dog and choose a language just because it has a nice library for something.…

> It's not the fault of the format if someone chose to use it in a poor way.

Which is why we've ended up with things like WSDL which define another layer on top of XML to make it actually usable for the thing it is used for. Hence the collective exhale when JSON showed up.

Re: Do you hate XML? (2010)

#66
post #37

I dislike it because it failed in such a fundamental way as a way to represent a document; you cannot, in general, reliably determine what characters the bytes in an XML file represent - the best a general XML processor can do is guess.

By default XML is either UTF-8 or 16, any other encoding has to be identified either through metadata or an explicit declaration in the document itself.

If you are guessing it is because someone failed to properly store or transmit the document.

Re: Do you hate XML? (2010)

#67
post #2

In my opinion, the reason people hate XML is because of what M signifies: it is a markup language and most of the time we don’t need a markup language. Markup languages are great for rich text documents. They are just not a good fit for representing data. The markup-nature of XML introduces unnecessary choice in whether to use an attribute or a child element to represent data; for HTML such ambiguity doesn’t actually…

Attributes are intended to hold metadata, not data. It's not the fault of the format if someone chose to use it in a poor way. You also need to distinguish the format itself from the various libraries that may be available to parse/process it in a given language. It doesn't always make sense, even when it's an option, to let the tail wag the dog and choose a language just because it has a nice library for something.…

Again we come back to it being a markup language.

In markup, it's usually pretty clear what is data and metadata: hello world and not boldhello world because you don't want the word "bold" to literally appear in the document.

In structured data, the distinction is redundant.

Re: Do you hate XML? (2010)

#68
post #25
post #2

In my opinion, the reason people hate XML is because of what M signifies: it is a markup language and most of the time we don’t need a markup language. Markup languages are great for rich text documents. They are just not a good fit for representing data. The markup-nature of XML introduces unnecessary choice in whether to use an attribute or a child element to represent data; for HTML such ambiguity doesn’t actually…

> Why is the country name an attribute but not the rank? Perhaps because it's an example of what is possible in XML and how to parse it, and not, in fact, a particularly good or canonical example of XML?

It's a very typical example. The real world does look like this.

Re: Do you hate XML? (2010)

#69
post #36

XML was a good, well-intentioned idea. The problem, IMHO, was that rampant "xml-abuse" in the naughts. ws-* standards and over-engineered garbage like SOAP ("complex object access protocol") made people loathe XML. I did like JAXB in Java, XLST, schemas, XPATH. Never got into XSL, but it seemed like good thing too. It worked best when your tooling manipulated it for you or at least helped you in an intelligent way. M…

It's non-trivial to implement XML parser in a secure way, many stdlib ones are insecure by default. That should just not be a thing. XML has a bunch of vulnerabilities very specific to it, XXE is the most well known one, but you also have a bunch of DoSes due to expansions and XPath injection etc. An object serialization format should not have a bunch of footguns and vulnerability categories specific to it.

It's trivial to make a secure parser. The problem is that the secure parser doesn't follow the standard because the standard mandates insecurity.

Re: Do you hate XML? (2010)

#70

XML was a good, well-intentioned idea. The problem, IMHO, was that rampant "xml-abuse" in the naughts. ws-* standards and over-engineered garbage like SOAP ("complex object access protocol") made people loathe XML. I did like JAXB in Java, XLST, schemas, XPATH. Never got into XSL, but it seemed like good thing too. It worked best when your tooling manipulated it for you or at least helped you in an intelligent way. M…

Honestly, some of the worst aspects of SOAP were legacies of XML-RPC. Some of the remaining messy parts were often "yes, you can not implement that, but then if you ever need functionality X, Y, Z - you will be fucked without this complexity".

Similar to how we have DER in ASN.1.

The rest in my experience was often related to crappy "generate me XML interface from my crappy Java/.NET class" because enterprise software demands speed of development over everything else, even if that speed is taken away by meetings

Post reply on HN